I have a MSBUILD script (.bat file) which builds a project. I need the MSBuild script that will be executed locally (prior to committing to the repo) to run on a specific version of MSBuild that matches our build management and continuous integration server. The issue is that all the local Developer boxes currently have installed:
C:\Windows\Microsoft.NET\Framework\v3.5
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\MSBuild\14.0
So on their local box they run my build script:
msbuild MyProject.HelloWorld.proj
The problem is that it builds with whichever MSBuild version is listed highest in their Windows path environment variable.
I can tell which version of MSBuild was used by our build log.
I tried specifying the tools version by modifying the script to pass the Toolsversion parameter:
msbuild /toolsversion:14.0 MyProject.HelloWorld.proj
but to no avail the project was built with MSBuild version 4.0.
I could ask all the developers to modify the order of their environment path variable and place C:\Program Files (x86)\MSBuild\14.0 at the top, which then would cause it to build with MSBuild 14, but I was looking for a less obtrusive manner of accomplishing the task.
Additionally, there are other projects that need to be built with the older version of MSBuild, so depending on the project they may need to move the order of the path variables, which I'm trying to avoid.