Hi!
My app consists of three parts:
1. Client app
2. A webservice with sourcecodefunct ions
3. Local "end-user-compiled library"
The user does like this:
1. Download small app from Internet
2. Start application and login to my service
3. Small app downloads source code and compiles an assembly for it to use
So far so good. Everything works fine as long as I don't need any extra
resources.
For example: A Form with any Windows Forms control on it works fine. A form
containg icons or an ImageList with icons doesn't work since I have to
compile the resource into the assembly.
I use the CompileAssembly FromSourceBatch-function to create my assembly. I
read somewhere that .resx-files could be entered in the string [] as a part
of the code to compile but it doesn't work.
My problem is that I don't have physical resx-files. Only as string from my
service and I really dont want to create any files locally on the client
computer. I know that I can use resgen to make .resource-files and then add
csCompilerParam eters.CompilerO ptions = "/res:form.resour ce", but since I
don't want to create files it's not an option either.
In other words... how do I create my assembly using
CompileAssembly FromSourceBatch including my resx-files!!!
Regards Kristian
Here's how I do it. Pretty straight forward isn't it?
// Create compiler
csCodeCompiler = csCodeProvider. CreateCompiler( );
// Add references
CompilerParamet ers csCompilerParam eters = new
CompilerParamet ers(strLibrarie s, "ClientDownload .dll", true);
// Generate a dll
csCompilerParam eters.GenerateE xecutable = false;
// Set tempfilescollec tion
csCompilerParam eters.TempFiles = csTempFiles;
// Compile library
csCompilerResul ts =
csCodeCompiler. CompileAssembly FromSourceBatch (csCompilerPara meters,
strCode );
return csCompilerResul ts;
My app consists of three parts:
1. Client app
2. A webservice with sourcecodefunct ions
3. Local "end-user-compiled library"
The user does like this:
1. Download small app from Internet
2. Start application and login to my service
3. Small app downloads source code and compiles an assembly for it to use
So far so good. Everything works fine as long as I don't need any extra
resources.
For example: A Form with any Windows Forms control on it works fine. A form
containg icons or an ImageList with icons doesn't work since I have to
compile the resource into the assembly.
I use the CompileAssembly FromSourceBatch-function to create my assembly. I
read somewhere that .resx-files could be entered in the string [] as a part
of the code to compile but it doesn't work.
My problem is that I don't have physical resx-files. Only as string from my
service and I really dont want to create any files locally on the client
computer. I know that I can use resgen to make .resource-files and then add
csCompilerParam eters.CompilerO ptions = "/res:form.resour ce", but since I
don't want to create files it's not an option either.
In other words... how do I create my assembly using
CompileAssembly FromSourceBatch including my resx-files!!!
Regards Kristian
Here's how I do it. Pretty straight forward isn't it?
// Create compiler
csCodeCompiler = csCodeProvider. CreateCompiler( );
// Add references
CompilerParamet ers csCompilerParam eters = new
CompilerParamet ers(strLibrarie s, "ClientDownload .dll", true);
// Generate a dll
csCompilerParam eters.GenerateE xecutable = false;
// Set tempfilescollec tion
csCompilerParam eters.TempFiles = csTempFiles;
// Compile library
csCompilerResul ts =
csCodeCompiler. CompileAssembly FromSourceBatch (csCompilerPara meters,
strCode );
return csCompilerResul ts;
Comment