Answer the question
In order to leave comments, you need to log in
How to programmatically compile a project in C#?
The following task arose: it is necessary to compile a project (one or several .cs files) from a C# program, which is located in a certain directory. Found this solution:
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = true;
parameters.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromSource(parameters,SourceString);
Answer the question
In order to leave comments, you need to log in
You can work directly with csc.exe
it by passing it a list of files to compile, and if you need to compile VS projects, with resources, etc., then you need to look at the VS architecture, in particular MSBuild, as well as its API, which are used in plugins for VS .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question