简体   繁体   English

从VS扩展中调用MSVC编译器

[英]Invoking MSVC compiler from VS extension

Is it possible to invoke cl.exe, the MSVC++ compiler, from inside a Visual Studio extension? 是否可以从Visual Studio扩展中调用MSVC ++编译器cl.exe? I'm using VS2010 and not bothered about maintaining compatibility for 2008/2005. 我使用的是VS2010,并不为维护2008/2005的兼容性而烦恼。 I've hunted through MSDN and had a poke through my DTE object, but not found anything of use. 我通过MSDN进行了狩猎,并通过DTE对象进行了戳戳,但是没有发现任何用处。 The documentation on what you can do with this stuff is kinda sparse. 关于您可以使用这些东西做什么的文档还很少。

如果您只是设置适当的环境变量,则当然可以从普通命令行调用cl.exe。

I agree that the documentation for VSX can be confusing. 我同意VSX的文档可能会令人困惑。 I'm a bit unclear about what you're trying to do, are you trying to execute cl.exe directly, or do you just want to compile the current project/solution? 我不清楚您要做什么,是要直接执行cl.exe,还是只想编译当前的项目/解决方案?

If you're just looking to build the current solution, from an Add-In you can do something like this: 如果您只是想构建当前的解决方案,则可以通过外接程序执行以下操作:

_applicationObject.Solution.SolutionBuild.Build()

Let me know if I misunderstood your question. 如果我误解了您的问题,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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