NuGet update fails, does not seem to pick up VisualStudioVersion correctly?

Windows 2012 R2 build server, TeamCity 8.1.1, nuget.exe 2.8.1

After enabling and testing a build configuration that involved a regular full build clean followed by a NuGet restore, we enabled incremental VCS updates and have enabled NuGet update on our build configuration. The build configuration now fails with this error during NuGet update:

[Step 1/4] update: Updating NuGet packages for OurSolutionName.sln
[22:20:10]NuGet command: D:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe update D:\TeamCity\buildAgent\work\52034b1c4c1ab5f5\OurSolutionName.sln -Verbose -RepositoryPath D:\TeamCity\buildAgent\work\52034b1c4c1ab5f5\packages
[22:20:10]Starting: D:\TeamCity\buildAgent\temp\agentTmp\custom_script9174264003705363137.cmd
[22:20:10]in directory: D:\TeamCity\buildAgent\work\52034b1c4c1ab5f5
[22:20:10]Scanning for projects...
[22:20:10]The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TypeScript\Microsoft.TypeScript.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  D:\TeamCity\buildAgent\work\52034b1c4c1ab5f5\proofs\MvcRouting\MvcRouting\MvcRouting.csproj
[22:20:11]Process exited with code 1
[22:20:11][Step 1/4] Step Update nuGet packages (NuGet Installer) failed

I looked at the csproj file mentioned in the error, and it uses the standard compatibility logic to determine the visual studio version and set the paths appropriately, only falling back to 10.0 if VisualStudioVersion is null.  I checked in the solution file and I have confirmed that the VisualStudioVersion is 12:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0

As a desperate measure, I tried hard-coding the visual studio version into the project with parameter env.VisualStudioVersion, but the needed value (12.0) does not work; if I set env.VisualStudioVersion = 12, then it picks it up (and fails in the build configuration because the folder is 12.0), but if I set it to 12.0, then this parameter is seemingly ignored; I get exactly the same error message as above, with nuget update calling the v10.0 folder (which doesn't exist.)

I can't really work out the magic I am missing; any recommendations for next steps?

Please sign in to leave a comment.