0
votes

I'd like our developers to use one version of Visual Studio for all of our projects (where possible) - to that end, I've asked them to use VS2019 for some projects that were originally created in VS2010 and then migrated to VS2013.

A runtime behavior change occurred when running one of these old webforms applications in VS2019. I'm not sure why it's different since the dlls being used are the same and the compiled IL is the same for the method in question, but at the moment I don't really care about "fixing" it since it would require making code changes and regression testing the entire application; a path I'd like to avoid for the moment.

What I'd like to do is make sure VS2019 builds with the indicated tools so that we retain the old behavior. The project file is referencing tools version 12 (VS2013 is not installed), but when Visual Studio builds I see the following in the MSBuild output:

Project file contains ToolsVersion="12.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="Current". For more information, please see http://go.microsoft.com/fwlink/?LinkId=293424.

I installed MSBuild Tools 2013, but that didn't correct the issue before or after a restart. I also tried with tools version 15 and got the same error (VS2017 is installed).

MSBuild from the VS2019 dev command prompt worked, but I had to copy the 14.0 webapplication targets to a new folder named "16.0". I'm not sure why there is a 14.0 folder but no 12.0 or 15.0 folder without doing more searching online.

Is this a fool's errand, or am I missing something simple?

1
,I suggest you could try my solution.Mr Qian

1 Answers

0
votes

MSBuild from the VS2019 dev command prompt worked, but I had to copy the 14.0 webapplication targets to a new folder named "16.0". I'm not sure why there is a 14.0 folder but no 12.0 or 15.0 folder without doing more searching online.

Update 1

This is just a prompt warning to ensure that you'd better use the related MSBuild version to build the project. It is designed as a reminder message.

But in fact, MSBuild does add backward compatibility feature.

The message is just a warning rather than an error and will not break the build process. And if it breaks the build process, it can prove that backward compatibility is not supported.

You can test it: use VS2019 to build a VS2017 or VS2015 projects and I am sure that it can built them successfully.

==============================================

Each version of VS creates a project that is built for the corresponding MSBuild version.

For example, in the project created in VS2010, its ToolsVersion="4.0", so when you use MSBuild from VS2010(msbuild v4.0), it will built without that warning.

VS2013-->ToolsVersion=12.0 , VS2015-->ToolsVersion=14.0 , VS2017-->ToolsVersion=15.0, VS2019--> ToolsVersion=Current

So when you build the project, you should try the related msbuild version to build them.

Although MSBuild supports backwards compatibility, the problem is always in the form of a warning, which has been troubling us during the project migration.

Solution

To solve it, you should use the related MSBuild to build the project with the corresponding ToolsVersion.

If you want to build them in VS2017, you should change ToolsVersion to 15.0 in every project's xxx.xxproj file.

enter image description here

If you want to build them in VS2019, you should change ToolsVersion to Current in every project's xxx.xxproj file.

enter image description here

More info, you can refer to my answer in this similar issue.