MSBuild does not contain a value for the "VCTargetsPath" property
I recently installed the Visual Studio 11 Developer Preview to try it out, and now my VS 2010 projects won't open. Instead, I get the following error message:
MSBuild does not contain a value for the "VCTargetsPath" property
I found someone that had reported the issue here on Connect, and the response from Microsoft was:
Posted by Microsoft on 12/2/2011 at 5:25 PM
Hi Afshin,Thanks for the feedback. The issue you ran into is fixed for the next public release Visual Studio.
Jim Griesmer
Visual C++ Team
Fantastic. So how do I restore VCTargetsPath so my projects will work again?
"VCTargetsPath is a toolset property that is defined in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0. "
I browsed to the VCTargetPath value in the registry and it has the value:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
Not sure where to go from here. Any suggestions?
It seems reasonable that the solution Gavin Pugh gave would fix the problem, though I didn't try it. I too ran into this problem after uninstalling the Developer Preview of VS11. I think I know what is really wrong though.
Mladen Jankovic was on the right track. One of the follow two (necessary) registry keys was missing on my machine:
-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0
- Key Name:
VCTargetsPath
- Type:
REG_SZ
- Value:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
- Key Name:
-
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0
- Key Name:
VCTargetsPath
- Type:
REG_SZ
- Value:
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
- Key Name:
(You can edit registry keys in Windows by typing +R+regedit+Enter)
For me, the second value I listed above was the one that was missing. After I added it, I was able to work with my project again.
Here's the thing that did trick for me:
Change registry value named DefaultToolsVersion
located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\4.0
from 2.0
to 4.0
. Do the same thing in Wow6432Node
too.
The registry editing method suggested by "Mladen Jankovic" didn't work for me.
I just ran a repair on Visual Studio 2010 (run the setup.exe on the VS2010 install disc, or invoke the 'uninstall' via Control Panel->Programs). It did the trick for me.
You also should run the SP1 install again.
For what it's worth, my 'add-ins' (including Incredibuild) behaved fine after this. They didn't need to be reinstalled or repaired. My settings/window/debugger placement also was retained.
Apparently this issue only presents itself if you uninstall the Developer Preview of VS11: http://www.gamefromscratch.com/post/2011/12/15/Do-not-remove-Visual-Studio-2011-developer-preview!.aspx