I have the following problem, will try to describe it shortly.
In my program there is to be a possibility to compile a winform to an .exe by clicking on a button.
Now I tried to do it with CodeDom, so in my program I have the following line:
CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, text);
where codeProvider is CodeDomProvider and text is the source from where to compile.
Problem is the winform I need to save as an .exe has a class behind it that uses other classes and forms, and, since parameter ‘text’ is a string parameter, it has to include all those classes, which results in HUGE amount of code, not to mention plenty of mistakes. Here‘s an example of what I mean.
There must be other ways, question is, what are they? Thanks in advance!
If you always use the same set of classes, it would be worth putting those common classes in a class library, and referring to that from the dynamically compiled code.
If they’re not the same in every case, it’s hard to see improvements you expect – if that much code has to be compiled, it has to be compiled, and there’s that much code which can have mistakes in it.