An extension for Visual Studio 2015 that sets the MSBUILDDEFAULTTOOLSVERSION to a per-solution setting before every build.
- Open a solution file for either VS2015 or VS2017.
- Build the solution. I prefer building with Release configuration.
- Go into your build directory to find
SetToolsVersion.vsix
. This is your extension file. You may distribute this file; it is self contained. - Double-click on the file to install for either VS2015 or VS2017.
- Before using the extension, we must have the MSBuild version of interest installed on your system.
Once the extension is installed, you may use it with any solution, but you have to do the following:
- Add a
.toolsversion
file at the same level as your*.sln
file. This file should be checked into your source control repo. - In
.toolsversion
type the MSBuild version you'd like to use (i.e.12.0
). - Make sure to clean your solution and restart visual studio before moving forward.
- In your output window you should see the following:
- This line at the beginning of the build:
Setting MSBUILDDEFAULTTOOLSVERSION to 12.0
- And this line by the end of your build:
Restoring MSBUILDDEFAULTTOOLSVERSION