机器安装了VS2010和VS2015后, 又卸载了VS2015,用VS2010打开工程文件,报以下错误:express
W:\Common\Common.csproj : error : 没法读取项目文件“Common.csproj”。 Cannot evaluate the property expression "$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\'))" found at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0@VCTargetsPath". Invalid static method invocation syntax: "[MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140\')". Method '[MSBuild]::ValueOrDefault' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)).
网上查了一下,缘由是卸载VS时,没有把注册表清理干净的缘由。ide
注册表位置:visual-studio
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions 删除全部12或以上的版本便可。ui
参考: http://stackoverflow.com/questions/26978418/visual-studio-cannot-open-or-make-projectlua