0

I've created an MSBuild proj file that contains the following header:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" TargetFrameworkVersion="4.5" VisualStudioVersion="VersionLatest">

This proj file is used to trigger an MSBuild on a number of SSDT projects, couples with a Deploy.

For most developers, this is fine. However, one dev encounters a Deploy72002 exception when trying to run the build. According to this answer, this is due to the VisualStudioVersion not being set. Sure enough, adding

set VisualStudioVersion="12.0"

in the batch file prior to the MSBuild call fixes the problem.

However, I was under the impression (I can't find the source now) that setting VisualStudioVersion="VersionLatest" in the xml of the proj file was sufficient to make it use the highest version of VS installed. I've even tried setting it from VersionLatest to 12.0, and also moving it from the root node, into a node of it's own in <PropertyGroup>.

I'd rather not have a hardcoded reference to 12.0 in the batch file. Am I missing something obvious to make VersionLatest work?

Community
  • 1
  • 1
Obsidian Phoenix
  • 4,083
  • 1
  • 22
  • 60
  • "VersionLatest" is simply hard-coded to 12.0 right now in Microsoft.Build.Utilities.v12.0.dll. The next version of VS is probably going to have another MSBuild version that is probably going to hard-code it to an unlucky number. Or it will stay 12.0 because you are asking for ToolsVersion 12.0 :) Don't do anything drastic until you have that version and know what it does. – Hans Passant Nov 13 '14 at 16:54
  • Even if it's hardcoded to 12 in the system, why isn't it being picked up from the .proj file for this one developer? – Obsidian Phoenix Nov 14 '14 at 08:22

1 Answers1

0

Try this: run MsBuild with the command line option to generate a preprocessed single file. Do the same on a working computer with the same version. Diff the files produced.

It might be picking up different contents for some .props or .targets file. These have been known to change due to installing or updating some or another. I recall following a msdn article to fix such a file when I looked up a problem.

JDługosz
  • 5,592
  • 3
  • 24
  • 45