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

查看:242
本文介绍了如何使用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.

我面临的问题很奇怪.

The problem I am facing is strange.

如果我在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)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.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]

我正在使用的命令如下:

The command I am using is the following:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe f:\snake\W9A30040.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中

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

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

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