如何使用 MSBuild 瞄准 v110 平台工具集? [英] How to use MSBuild to target v110 platform toolset?

查看:18
本文介绍了如何使用 MSBuild 瞄准 v110 平台工具集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个命令行应用程序,它创建由单个 VC++ 项目组成的完整 Visual Studio 11 解决方案,并尝试最终使用 MSBuild 对其进行编译.

I am developing a command line application that creates a full Visual Studio 11 solution made of a single VC++ project and that tries to compile it in the end using MSBuild.

我面临的问题很奇怪.

如果我在 Visual Studio 11 中执行我的命令行程序,它就可以工作;如果我改为在开发环境之外启动它,则会引发错误:

If I execute my command line program inside Visual Studio 11 it works; if I instead launch it outside the development environment it throws me the error:

C:Program Files (x86)MSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.Targets(511,5): error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected. [f:ABC.vcxproj]

我使用的命令如下:

C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe f:snakeW9A30040.vcxproj /property:PlatformToolset=v110;Configuration=Debug /v:quiet

但我感觉 PlatformToolset=v110 被忽略,MSBuild 使用 v100 (Visual Studio 2010).

But I have the feeling that PlatformToolset=v110 is ignored and MSBuild use v100 (Visual Studio 2010).

您对如何告诉 MSBuild 为 v110 平台工具集进行编译有什么建议吗?

Do you have any suggestions how to tell MSBuild to compile for v110 Platform Toolset?

推荐答案

我找到了解决这个问题的方法;可能是 Visual Studio 11 Beta 的问题,将在正式发布之前解决.

I found a workaround for this issue; could be a problem of Visual Studio 11 Beta that will be resolved before official release.

无论如何,如果您有兴趣,只需在调用 MSBuild.exe 之前将环境变量VisualStudioVersion"设置为11.0"即可.

Anyway, if you are interestedm just set the environment variable "VisualStudioVersion" equal to "11.0" before calling MSBuild.exe.

在批处理文件中

set VisualStudioVersion=11.0

或在 VB.NET 中

or in VB.NET

Environment.SetEnvironmentVariable("VisualStudioVersion", "11.0")

这篇关于如何使用 MSBuild 瞄准 v110 平台工具集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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