Where is "Retarget Solution" in Visual Studio 2022 - build

I use Visual studio build one USB SDK, I got this message:
Error MSB8020 The build tools for WindowsKernelModeDriver10.0 (Platform Toolset = 'WindowsKernelModeDriver10.0') cannot be found. To build using the WindowsKernelModeDriver10.0 build tools, please install WindowsKernelModeDriver10.0 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". usbsamp (Sys\Driver\usbsamp) C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets
I try following this, use "Retarget Solution", but I can't find it in Project menu, is it for early visual studio? How I can fix it in Visual Studio 2022?

Visual Studio use different method set this, after I use Project->property->general->Platform toolset change to Visual Studio 2022, the error is fixed.

Related

Visual Studio Project 2019 project still require msvcr120d.dll

I migrate Visual Studio 2013 project to visual studio 2019 and recompiler my all dlls and other files using visual studio 2019. But when I run my application, it still requires msvcr120d.dll in release mode.
Anyone help me out to fix this.
Go to settings and select proper Platform Toolset
for vs2019 select v142

Downgrade Visual Studio 2019 back to Visual Studio 2017

There is a lot of answers related to upgrading a solution from Visual Studio 2017 to Visual Studio 2019 on StackOverflow. But how do I downgrade back to Visual Studio 2017? When I try to build a project in Visual Studio 2017 I get the following error:
Error MSB8020.
The build tools for v142 (Platform Toolset = 'v142') cannot be found. To build using the v142 build tools, please install v142 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".
Before that, I used Visual Studio 2019 with the solution and it worked fine. But now I have to use Visual Studio 2017 instead and as expected I have errors. Is there a way to fix it not recreating the solution manually? Thanks for advice!
This problem is with your MSBuilder, re check the version of MSBulder in Visual Studion sometime it may be still support for vs2019.
or
You can changed this in your project
to: Project->Properties->General->Platform Tool_set and change to the current version of your VS.
Think this will be helpful.!

Unable to run msbuild for C++ from the command line VS2017

I have a project that has only ever lived in Visual Studio 2017. It's a C++ dll, and up until this point I've had no problem building it from within the Visual Studio GUI. However now I'm trying to set up automation that will build the project on the command line and upload the output files to a desired location. Here's what I've tried so far (in a brand new Command Prompt):
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>
vcvarsall amd64
cd C:\Users\me\development\MyProject
msbuild MyProject.slnl (or msbuild MyProject\MyProject.vcxproj)
And this gives me the error output
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Cpp.Platform.targets(57,5):
error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build
using the v141 build tools, please install v141 build tools. Alternatively, you
may upgrade to the current Visual Studio tools by selecting the Project menu or right-cli
ck the solution, and then selecting "Retarget solution".
[C:\Users\dev\development\MetaReme\MetaReme\MetaReme.vcxproj]
Let me reiterate that I've been successfully building within Visual Studio 2017 targeting the v141 toolset, it's just on the command line I'm having trouble. Within my Visual Studio Installer application I have the VC++ 2017 v141 toolset checked. I've looked on the filesystem and within C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\ there is no v141 folder.
Thanks!
Thanks guys! I was following https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line which says "By default, these tools are installed in drive:\Program Files (x86)\Microsoft Visual Studio version\VC\bin.". Obviously these docs are outdated... I was able to get it to work with the following commands
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvars64
cd "C:\Users\me\development\MyProject"
msbuild MyProject.sln
It says in the first part of the paragraph in the mentioned article:
In Visual Studio 2017, these are located in the VC\Auxiliary\Build subdirectory of the Visual Studio installation directory. In Visual Studio 2015, these are located in the VC, VC\bin, or VC\bin\architectures subdirectories of the installation directory, where architectures is one of the native or cross compiler options.
As you are using Visual Studio 2017, they should be in VC\Auxiliary\Build, like you found out.
Another way to find the correct .bat files would be through the command prompt shortcuts mentioned in the same article. First locate them by expanding start->Visual Studio Year, right click and find their location. Then check the location they are pointing to.

Share project between Visual Studio 2013 and Visual Studio 2012

I am using Visual Studio 2013 community and created C++ project.
I want to share the project with a colleague working with Visual Studio 2012 professional.
Once he took the project he had to change the toolset to v110 and it worked just fine for him.
When he shared it back with me I got the message:
error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = 'v110') cannot be found.
To build using the v110 build tools, please install Visual Studio 2012 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 "Upgrade Solution...".
I do not want to upgrade the solution, as that will cause us each time to change the project, but I couldn't find anywhere to download the VS2012 build tools.
Where can I find Visual Studio 2012 build tools?
You can have both Visual Studio 2012 and Visual Studio 2013 installed on the same machine. Once you have both installed you can use the Visual Studio 2012 compiler in Visual Studio 2013.
So I suggest you install Visual Studio 2012. I think Express edition should be enough.
Alternatively, your colleague can install Visual Studio 2013 Community Edition alongside his existing Visual Studio 2012 Professional Edition. I think the features are roughly equivalent the only question is if they are breaking the license terms.

What is "Platform Toolset" setting in visual studio project

I have three doubts. Anyone there for help?
What is the "Platform Toolset" project setting in VS project
Why such setting required
What happen, if I change the setting (v110 to v100)
It is an MSBuild property that controls the specific version of the platform toolset that you want to use.
More info here: http://msdn.microsoft.com/en-us/library/windows/hardware/hh454232%28v=vs.85%29.aspx
Most likely you want to use the last stable Windows SDK. You can check the toolset that you are using looking at your Visual Studio project file (.vcxproj), looking for this XML entry:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label="Configuration">
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
</PropertyGroup>
Moreless it is a version of toolchain that is used to build your project. So depends on version you have selected, different compiler, linker (etc) versions are used. If you select toolset version that was released with VS2017 (v141), MSBuild will use tools from this toolset do build your project.
It is nicely described under link provided by: YoavKlein.
"The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Since Visual Studio 2015, the major version of the toolset has remained at 14, which means that projects compiled with Visual Studio 2019 or Visual Studio 2017 are ABI-backwards-compatible with projects compiled with Visual Studio 2015. The minor version has updated by 1 for each version since Visual Studio 2015:
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142"
So there is no difference in ABI if the major version is same (but in your case you ask about change from v110 to v100 so the compatibility may be broken), but it may happen that f.e. compiler provided with older version of toolset does not implement some features of the new or incomming c++ standard etc.
It is the version of all the tools used to compile and link your project.
The mapping between PlatformToolset and Visual Studio versions is as follows
Visual Studio 2012: v110
Visual Studio 2013: v120
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142
Visual Studio 2022: v143
(v130 was skipped)
Taken from
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/platform-toolset
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=msvc-170
https://marcofoco.com/blog/2015/02/25/microsoft-visual-c-version-map/
In Visual Studio, in Solution Explorer, open the shortcut menu for your project (not for your solution) and then choose Properties to open your project Property Pages dialog box.
In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
In the left pane of the dialog box, expand Configuration Properties and then select General.
In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you have installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project.
Choose the OK button.
I Would refer to this link, i think it's explained better there:
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=vs-2019