如何以编程方式构建Visual Studio解决方案? [英] How can I programmatically build a Visual Studio solution?

查看:101
本文介绍了如何以编程方式构建Visual Studio解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过传递解决方案文件路径(.sln文件)和构建模式(调试,发布)来编译解决方案。

I would like to compile a solution by passing the solution file path (.sln file) and the build mode (debug, release).

我不想要调用诸如devenv.exe或msbuild.exe之类的命令行进程。相反,我想使用API​​并知道是否存在编译错误。

I do not want to call a command line process like devenv.exe or msbuild.exe. Instead I would like to use an API and know if there were compile errors.

有可能吗?

如果您认为自己会做的话,请提供示例。

Please provide samples if you think you know how to do that.

推荐答案

您将不得不在某个地方启动一个流程指向进行编译,因此您最好生成一个启动编译的过程。

You're going to have to launch a process at some point to do the compilation, so you might as well spawn a process to kick off the compilation. It is going to be much easier than struggling with an API.

安德鲁(Andrew)就如何使用它提供了一些很好的建议,但我仍然认为这是一个错误。

Andrew gives some good advice about how you might go about it, but I still think it is a mistake.

这篇关于如何以编程方式构建Visual Studio解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆