How to programmatically create and compile another C # project from the current project

Program A: Outputs a C # function and paste the function into a file (e.g. Classifier.cs) in another C # project. These steps are already implemented.

I am wondering if there is a way to programmatically build and compile a C # project of a project inside project A. Therefore, I can click a button in project A, it will automatically add a new function to project B, build, compile project B. And finally, start a new project B .

Thank.

+5
source share
2 answers

No need to execute a new process..NET gives us a way to programmatically call the C # compiler. I believe this method works well:

http://blogs.msdn.com/b/dohollan/archive/2010/08/09/programmatically-invoke-the-c-compiler.aspx

+2

, Visual Studio, MSBuild ProjectB.csproj. , , Visual Studio.

0

All Articles