Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MSBuild to target v110 platform toolset?

Tags:

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)\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

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?

like image 473
Drake Avatar asked Apr 23 '12 12:04

Drake


People also ask

How do I run MSBuild target?

To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.

How do I use MSBuild?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

How do I find my platform toolset?

Select and hold (or right-click) the driver project in Solution Explorer and select Properties. In the property pages for the driver project, select Configuration Properties and then select General. Select the Platform Toolset property for the project from the drop-down list.


1 Answers

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:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.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.

like image 55
Spencer Avatar answered Sep 23 '22 02:09

Spencer