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:
If working with VS 2010 SP1, go to Control Panel | Uninstall a program, Uninstall/Change the VS 2010 SP1 and pick reapply SP1. It worked for me.
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
VCTargetsPath
REG_SZ
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0
VCTargetsPath
REG_SZ
$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\
(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.
Ugh I finally found the answer for this, which incidentally didn't give me the same error message - I get:
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
For some reason it worked fine with 32-bit builds, but not 64-bit builds.
Anyway, the solution is to copy all the VCTargetPath*
keys from HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild ToolsVersions\14.0
to HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0
. They were missing for me.
Actually I only copied VCTargetsPath
and VCTargestPath14
because copying is quite tedious. Seems to be sufficient for VC++ 2015.
For those who are here by google search :
If you had previously installed VS 2015 or any later versions of vs after vs2010, and then uninstalled, Here is the solution for you.
In the error message below :
Cannot evaluate the property expression "$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))"
14.0 is the version number of VS2015. Unfortunately, the VS2015/2012 uninstaller forgets one of its registry keys, which then causes that error when you go back to VS2010.
Go to start/run/ regedit >
Look for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 (12.0 as well)
And
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\14.0 (12.0 as well )
If there is a key 14.0/12.0 here, delete it and your VS2010 will hopefully work again.