機器安裝了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