// This constructor should be used if you're going to be using only source files rather than strings that contain the source. Although you could use empty lists // and strings with the other constructors. public Compiler(CompilerLanguages language) { if (language == CompilerLanguages.csharp) { CodeProvider = CodeDomProvider.CreateProvider("CSharp"); } else if (language == CompilerLanguages.visualbasic) { CodeProvider = CodeDomProvider.CreateProvider("VisualBasic"); } }
// This constructor can be used when you have a list of strings with source code and you need to add assemblies (dlls) and you want to embed needed dlls. // The assemblies need the full the path if they are not located in the GAC. public Compiler(CompilerLanguages language, List <string> sourcestrings, List <string> assemblies, List <string> embed) : this(language, sourcestrings, assemblies) { Embed = embed; }
// This constructor can be used when you have a list of strings with source code and you need to add assemblies (dlls) that are referenced. // If the Assemblies are not in the GAC, full paths need to be used. Or they need to be findable in some way. public Compiler(CompilerLanguages language, List <string> sourcestrings, List <string> assemblies) : this(language, sourcestrings) { Assemblies = assemblies; }
// This constructor can be used when you have one string that contains source code that you want to compile. public Compiler(CompilerLanguages language, string sourcestring) : this(language) { SourceStrings.Add(sourcestring); }
// This constructor can be used when you have several strings with source code in them. public Compiler(CompilerLanguages language, List <string> sourcestrings) : this(language) { SourceStrings = sourcestrings; }