Visual studio 出现 的类型初始值设定项引发异常

最近电脑老旧了,突然Visual studio也不能用了。症状是,只有VS2010能用,之前Vs2013,Vs2017不能正常打开。于是修复,卸载,重装。都试了个遍。结果vs2013,vs2017都不能再正常安装了。vs2015也装不了。就剩vs2010这个独苗了。好在马上也告别这电脑了。就将就用下vs2010吧。结果一打开,连vs2010也不能用了了。报如下错误。把

VS2010\VS2012出现“”的类型初始值设定项引发异常。

Visual studio 出现 <Module> 的类型初始值设定项引发异常_第1张图片

1.将全部.net framework**全部**卸载掉!!!(这是重中之中) 
2.在网站上下载刚才卸载.net framework 的版本 

3.再重新安装一遍,问题就解决了!

上面这个错误没有了。但是,项目代码不能正确加载了。报如下的错:

When I open or create a project in Visual Studio C# 2010 Express I get this error:

Cannot evaluate the property expression "$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V120\'))" found at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0@VCTargetsPath". Invalid static method invocation syntax: "[MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V120\')". Method '[MSBuild]]::ValueOrDefault' not found. Static method invocations should be of the form: §([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(ab)).

I had the same issue when I had previously installed VS2013 and then uninstalled. This happens because VS2013 uninstaller forgets one of its registry keys, which causes this error when you start to work with VS2010 again.

Delete if there is a key with 12.0 in this location.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions

Hopefully VS2010 will work again. 搞定了。

share improve this answer

你可能感兴趣的:(C#)