无法加载文件或程序集SMDiagnostics.dll

时间:2012-06-05 10:32:21

标签: c# .net visual-studio-2010 .net-4.0 .net-3.5

我正在尝试构建包含18个项目的c#.NET解决方案。出乎意料的是,我收到了一个奇怪的错误消息,我的一个项目(网络gui)。

错误如下

"Error 1839 'Could not load file or assembly 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'"

除了一个项目之外的所有项目都在.net framework 3.5上运行,但我的机器上安装了框架4.0。 Visual Studio试图从4.0但不是3.5加载文件(我试图将文件移动到3.5,但这不起作用)

有谁知道这里有什么问题,或者知道我能做些什么来解决这个问题?

问候 Throstur

2 个答案:

答案 0 :(得分:4)

我从上面得到了同样的错误..项目目标框架设置为3.5。将其更改为4.0,我能够成功构建。

答案 1 :(得分:2)

我的所有项目都设置为使用.NET 4.0,其他答案对我不起作用,但最终还是弄明白了。简单:

  1. 右键单击Visual Studio和“以管理员身份运行”
  2. 在新打开的Visual Studio实例中,打开解决方案并运行它。
  3. 对我来说,它只是按预期工作。 感谢this answer帮助我弄明白。