How to Compile the .cs file into .dll in C#.Net programatically?
Can any one help me in converting the .cs file into .dll programmatica开发者_运维百科lly?
You're looking for the CSharpCodeProvider
class.
For example:
var compiler = new CSharpCodeProvider(new Dictionary<string, string> { { "CompilerVersion", "v4.0" } });
var options = new CompilerParameters { OutputAssembly = path);
var results = compiler.CompileAssemblyFromFile(options, sourceFile);
Take a look at the CSharpCodeProvider class.
精彩评论