Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

visual c++ - How to use MSBuild to target v110 platform toolset?

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.

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]

The command I am using is the following:

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

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I ran into the same problem as well with the full release of VS 2012. You can also set the VisualStudioVersion as a property with MSBuild as opposed to dealing with environment variables as mentioned in the accepted answer. For instance:

C:WindowsMicrosoft.NETFrameworkv4.0.30319MSBuild.exe .myproject.vcxproj /p:VisualStudioVersion=11.0

The environment variables approach I'm sure work just as well, I honestly didn't try that as I was trying to stay away from having to modify the environment variables.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...