0

I have a dll that contains a GUI that I want to be able to compile at run time. I have already checked using CodeCom from a different post Generating-dll-at-run-time

...
CompilerResults results = icc.CompileAssemblyFromSource(parameters, yourCodeAsString);

And I have tested it as:

string yourCodeAsString = @"

namespace Foo
{

public class Bar
{
    static void Main(string[] args)
    {
        Bar.SayHello();
    }

    public static void SayHello()
    {
        System.Console.WriteLine(""Hello World"");
    }
}
}
";

My question is: Since CompileAssemblyFromSource receives a yourCodeAsString and I am calling MyGUI:

using (MyGUI _gui = new MyGUI())
{
    _gui.ShowDialog();
    int value = _gui.GetUserInput();                                
}

How or where could/should I incorporate my GUI code?

I hope I made myself clear...

Cheers in advance

Community
  • 1
  • 1
clopezm
  • 89
  • 1
  • 8
  • Why are you dynamically compiling GUI code? That seems like a really odd requirement, can you explain what you are trying to do that you have to generate the code at runtime? – Scott Chamberlain Feb 11 '14 at 23:46
  • Hi, thanks for your reply. I know its an odd requirement. So far I've made the changes in the code, build the dll and deploy it. I was just wondering if it was possible to enable some other users without the coding experience/knowledge to generate them automatically.... – clopezm Feb 12 '14 at 00:06
  • If your users don't know how to program how do you expect them to write valid code to be parsed? You may be better off using a "[Domain-specific language](http://en.wikipedia.org/wiki/Domain-specific_language)" and parsing it to generate the GUI on the fly. – Scott Chamberlain Feb 12 '14 at 00:09
  • @ScottChamberlain - The don't need to write valid code to be parsed. I was thinking of creating a Settings GUI were they could specify the parameters they need for the dll and then compile it on the background. I still don't know if its feasible, that's why I posted the question....Cheers for the link! – clopezm Feb 12 '14 at 02:12

0 Answers0