Retargeting platform toolset - windows

I recently downloaded a project from GitHub which I need in my Visual Studio Solution. However the project was built with a different platform toolset: Visual Studio 2017 - Windows XP (v141_xp) (not installed). Compiling wouldn't work because the toolset required isn't installed.
Q: As I have Visual Studio 2017 with platform toolset (v141) can I tweak the project so that it will no longer ask for v141_xp toolset ?
I searched for a way to solve the problem(I really need that project), but the only suggestion so far is to create a new solution with my default toolset and import everything manually from the downloaded project(which is pretty big).

Do a rightclick on the project in Solution Explorer inside VS2017, open properties and change the Platform Toolset from v141_xp to v141

Related

Build fails for C++/CX project with v141 platform toolset in Visual Studio 2019

I have tried to switch to Visual Studio 2019 since it is now officially released, but I am having problems building a C++/CX based project.
I have not retargeted the project, but it is still configured to use the v141 platform toolset, i.e. Visual Studio 2017 Build Tools.
As far as I can tell, I have specifically installed the required build tools in Visual Studio 2019, which should be evident here:
Still, according to the project properties, Visual Studio 2017 Build Tools are not installed:
And when I build the project I get the following error:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(378,5): error MSB8020: The build tools for Visual Studio 2017 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install Visual Studio 2017 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
Am I still missing some components in my installation, or is this a bug in Visual Studio 2019?
EDIT I should point out that I still have Visual Studio 2017 installed on the same computer as well.
I had a similar issue, but this is what I was missing.
You will find these options on the Workloads tab of the VS installer on the right under Installation details (i.e. not under Individual components).
It turns out that the (Windows Runtime Component) project was not properly set up. In the .vcxproj file the ApplicationTypeRevision element was missing, which is also "evident" (if you know what you are looking for...) from looking at the project properties above, where only the General configuration properties node is visible, and the Target Platform value is empty.
Inserting the following line in the .vcxproj file immediately following e.g. the WindowsTargetPlatformMinVersion element should do the trick:
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
Most likely, it was also necessary to add the C++ Universal Windows Platform Tools. The v142 version was made available when trying to create a new C++ Universal Windows Platform project. As far as I could tell, this component was not otherwise visible in the Visual Studio Installer? Once the v142 component was installed, the corresponding v141 component was also available for installation.
I had this same problem for Visual Studio 2017, even though V141 was explicitly shown as installed. It turned out the problem was that VCTargetsPath was set in System Environment Variables to "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\V4.0\V140". Removing or unsetting this variable solved the issue.
I suspect this variable was set during an earlier install of Visual Studio 2015. Even after uninstalling all other Visual Studios the variable was never removed and the problem persisted.

Accessing (full) Visual Studio project properties after switching to platform toolset v90

I've installed Visual Studio 2008 SP1 C++ Express Edition, 2010 Ultimate and 2013 Premium.
I've opened my old Visual Studio 2008 project with VS 2013 and upgraded the Project Files.
Afterwards I've changed the Platform Toolset to v90.
The project is compiling fine but is there a way to access the project properties? I can't even find a way to switch back to the v120 toolset (I don't want it tho).
Project -> Properties will only show the following properties:
Is there a way to access the full project properties?
It seems that choosing v100 will cause the same issue.

The builds tools for v120 (Platform Toolset = 'v120') cannot be found

Using visual studio 2012 on windows 8 x64
aparantly this is caused by msbuild being moved into .net but I havn't seen how to fix it yet.
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5):
error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.
If you have VS2013 installed and are getting this error, you may be invoking the wrong MSBuild. With VS2013, Microsoft now includes MSBuild as part of Visual Studio. See this Visual Studio blog posting for details.
In particular, note the new location of the binaries:
On 32-bit machines they can be found in: C:\Program
Files\MSBuild\12.0\bin
On 64-bit machines the 32-bit tools will be under: C:\Program Files
(x86)\MSBuild\12.0\bin
and the 64-bit tools under: C:\Program Files
(x86)\MSBuild\12.0\bin\amd64
The MSBuild in %WINDIR%\Microsoft.NET\Framework\ doesn't seem to recognize the VS2013 (v120) platform toolset.
http://en.wikipedia.org/wiki/Visual_C++
You are using Visual C++ 2012 which is v110. v120 means Visual C++ 2013.
So either you change the project settings to use toolset v110, or you install Visual Studio 2013 on this machine and use VS2013 to compile it.
if you are using visual 2012
right-click on project name -> properties -> configuration properties -> general -> platform toolset -> Visual Studio 2012 (v110)
Download and setup Microsoft Build Tools 2013 from
http://www.microsoft.com/en-US/download/details.aspx?id=40760
To add up to Kevin and Lex's answers:
We had a similar situation at work where both the developers and the build server had Visual Studio 2013. Our solution had a VS 2013 C++ project and compiled fine when built on developer's machine or on the build server within the IDE.
The issue was when triggering builds using TFS build definitions. We were still using an old build template (version 11.1) instead of 12.0. Fortunately, a simple attribute addition to the template xaml file solved the issue.
In the Sequence portion "Compile the Project", there is a xaml node that starts with
mtbwa:MSBuild CommandLineArgument=....
You can add a "ToolPath" attribute and point it to the right path of the MSBuild.exe you wish to invoke, based on Kevin's answer. For instance:
ToolPath="C:\Program Files (x86)\MSBuild\12.0\Bin"
Wasted 4+ hours on this.
I have Visual Studio 2017 Enterprise, one of the projects has below error:
The builds tools for v120 (Platform Toolset = 'v120') cannot be found
To resolve above error, I tried to install all below:
Microsoft Build Tools 2013 (v120
tools) https://www.microsoft.com/en-US/download/details.aspx?id=40760
Microsoft Build Tools
2015 https://www.microsoft.com/en-in/download/details.aspx?id=48159
Build Tools for Visual Studio
2017 https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
However, none of the above worked.
Later, installed Visual Studio 2013 Ultimate, then all worked fine.
Looks like, the older Visual studio is a must to resolve this.
Hope it helps.
To add up to Louis answer:
Alternatively you can use the attribute ToolVersion="12.0" if you are using Visual Studio 2013 instead of using the ToolPath Attribute. Details visit http://msdn.microsoft.com/en-us/library/dd647548.aspx
So you are not forced to use absolute path.
When a VS2013 C++ project is opened in VS2015, and there are warnings about "The build tools for v120... cannot be found", I simply need to edit the .vcxproj file and change <PlatformToolset>v120</PlatformToolset> to <PlatformToolset>v140</PlatformToolset>, and close and re-open the solution.
In VS 2012, I was getting "SMB2 will not build: Error 1 error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools."
Throwing caution to the wind, I tried the suggestion: Selected the Solution in Solution Explorer, then clicked in the "Update VC++" menu item. This did some updateing and then started a build which succeeded.
The "Update VC++" menu item no longer appears in the solution menu.
i had a similar problem when i removed VS 2013 community Update 5 and switched over to VS 2015 community edition
and the problem acquired in windows phone 8.1 projects where it complained about not having the right msbuild toolset and about the emulators not installed even if they are.
i know that the source of the problem was the VS 2013 community settings that has been left by that last uninstall which messed everything for me even though the uninstall process went smooth with no problems from the control panel.
i did my best to remove any files left but there was always some thing left.
and what only fixed it for me is a fresh windows 10 x64 installation then after it i installed VS 2015 community edition and that's it!! no more errors for me and the wp8.1 emulator worked fine too!!
in my case now am completely sure that the previous visual studio install settings has messed everything for me and because there wasn't any way i found and tried to completely erase VS 2013 community files and settings i had to pay the price for it and reinstall my OS.
you might be able to avoid OS reinstall if you can find a way to completely erase last visual studio install files.
P.S:only attempt this solution(OS reinstall) after you tried every possible way first then if nothing works and only then ... make this solution as a last resort.
In VS2013 to set up all projects to correct build tools, you can do a right click on the solution in solution explorer and choose "Retarget solution". It will change all progects (all you check with the checkbox in opened dialog), so the error will be gone.
In my case, I have double-clicked a Visual 2013 sln file and Visual 2012 opened (instead of Visual 2013). Trying to compile with Visual 2012, a project that has the Platform Toolset set to "v120" showed the error above mentioned. However, reopening the sln with Visual 2013, the Platform Toolset was set to "Visual Studio 2013 (v120)" - please note the complete name this time -, actually did the job for me. The project compiles well now.
I was getting the same error with building USBView project in VS2015. I removed this error by selecting 'Platform Toolset' settings to to "Visual Studio 2015 (v140)" and than right click on solution (in VS2015) and select 'Retarget Solution' and selected 10.0.10240.0 on that dialog.
It seems like there is also ProjectUpgradeTool from microsoft which is suppose to convert older projects to upgrade to post VS2012 VS but I couldn't locate that tool on my machine.
I still have to fix some new linker error with help of this.
I had a similar problem. VS 2015 Community (MSBuild 14) building a c++ app, wanted to use VS 2010 (v100) tools. It all came down giving msbuild an invalid configuration option. Strange.
So, recheck all those options and parameters.
If you use make generators like cmake, JUCE, etc. try to set a correct VS version target (2013, 2015, 2017) and regenerate the solution again.
I was facing same issue while building some of project.
I used Visual Studio 2015 IDE, there it was working fine but while giving build from PowerShell script, it was giving toolset related "The builds tools for v140 (Platform Toolset = 'v140') cannot be found." error
So eventually it was issue of pointing to incorrect MSBUILD exe for the respective project.
Earlier I was pointing to
$MSBUILD="C:\windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
And build was successful when I updated script to point to
$MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
Hence to resolve the issue, please make sure to use correct MSBUILD.

can i resolve "error MSB8009 without installing VS2008 SP1

can i resolve error MSB8009: .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine. without installing vs 2008 SP1 for visual cpp project
Your project is set to target the VC9/VS2008 toolset - if you want to build in using VC10/VS2010 without having VS2008 installed you need to target the VC10 toolset.
Open the VS2010 solution file.
Go to the project properties dialog, Configuration Properties -> General
Change Platform Toolset from v90 to v100.
You will no longer be able to build using VS2008.

Using a v90 Platform toolset on VisualStudio 2010

In our company for software development we are mainly using VisualStudio 2010 (Platform toolset v100).
We ran into a situation where we needed to work with some poorly organized third party SDK that was compiled using VisualStudio 2008 (V90) and this SDK can't function normally while working in the "v100" platform toolset.
What I mean by "poorly organized" is.. imagine for example an SDK export functions that has something like a "std::string" in it.
The solution was to create a "wrapper" dll that we compiled using VS2010, but with a "Platform Toolset v90" option. But for "Platform Toolset v90" to work, we needed to install a VisualStudio 2008.
My question is: Is there any legal way to use v90 platform toolset in VS2010 without buying VisualStudio 2008? Maybe there is some kind of v90 "toolset package" or something that we could use?
Thanks.
As user1240436 stated in his comment, it should also be possible to install the Microsoft Platform SDK. I think v6.0 and higher contain the VC 9.0 and its environment.
As far as I know, it should be possible to use the Visual C++ 2008 Express Edition
It just has to be installed on the compiling machine, everything else could be done via VS2010. (This way you could also build multi project solutions etc)

Resources