Getting a successful Visual Studio 10 Team Build when Visual Studio 11 is installed locally
I was trying to build a project with the Azure SDK, and the team build was breaking because it couldn’t find the Azure MSBuild targets. Precisely, I was getting this error:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\1.6\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
The install of Visual Studio 11 was causing my $(VisualStudioVersion) environment variable to be overridden. For the most part, this was OK, but the Azure toolkit isn’t available for the CTP of Visual Studio 11, so that target file doesn’t exist.
I went out to this link, and saw that I needed to set the VisualStudioVersion as a parameter. According to the article:
These new methods also take a VisualStudioVersion enumerated value as a parameter to determine which tool subset to use. The VisualStudioVersion enumeration can have one of the following values:
VisualStudio10
VisualStudio11
VisualStudioLatest
Setting /p:VisualStudioVersion=VisualStudio10 resulted in:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\vVisualStudio10\Windows Azure Tools\1.6\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
So I tried “/p:VisualStudioVersion=v10.0”, but I missed that the tool prepended a “v” prefix for me.
Finally I tried “/p:VisualStudioVersion=10.0” and found success!
So, there’s a nice tip for my toolbox.