Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
797 views
in Technique[技术] by (71.8m points)

visual studio - 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_MACHINESOFTWAREMicrosoftMSBuildToolsVersions4.0. "

I browsed to the VCTargetPath value in the registry and it has the value:

$(MSBuildExtensionsPath32)Microsoft.Cppv4.0

Not sure where to go from here. Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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_MACHINESOFTWAREMicrosoftMSBuildToolsVersions4.0
    • Key Name: VCTargetsPath
    • Type: REG_SZ
    • Value: $(MSBuildExtensionsPath32)Microsoft.Cppv4.0
  • HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftMSBuildToolsVersions4.0
    • Key Name: VCTargetsPath
    • Type: REG_SZ
    • Value: $(MSBuildExtensionsPath32)Microsoft.Cppv4.0

(You can edit registry keys in Windows by typing enter image description here+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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...