vs2010初始值异常_Visual studio 出现 <Module> 的类型初始值设定项引发异常

2023-09-16 20:22

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

1.将全部.net framework**全部**卸载掉!!!(这是重中之中) 2.在网站上下载刚才卸载.net framework 的版本 3.再重新安装一遍,问题就解决了!

vs2010 编写的dll sdk 在vs2015编写的exe调用,出现问题,类型初始值设定项引发异常 ,在装有开发环境的机器上正常运行。 解决办法: 将dll重新以release生成后问题解决。

原因可能是不匹配的编译模式造成的。以上为千金难买的经验,记录并分享之^-^

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

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

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(a,?b)).

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