简体   繁体   中英

Programmatically build a Visual Studio solution?

Is there a way to programmatically build Visual Studio solutions? Eg if you are inside a console app, can you programmatically build an existing solution elsewhere?

Sure- MSBuild is included on any machine with .NET 2.0 or better installed. Just call it and pass the solution file, or drive the MSBuild classes (see Microsoft.Build.BuildEngine.Engine ) from your code to do it.

devenv.exe solution.sln / build“发布”

You should no longer use the Microsoft.Build.BuildEngine.Engine class. Per MSDN, "This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM