Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load a file or assembly SMDiagnostics.dll

I´m trying to build my c# .NET solution containing 18 projects. Out of the blue I´m receiving an odd error message for one of my projects (the web gui).

Error as follows

"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.'"

All but one of the projects are running on .net framework 3.5 but I have framework 4.0 installed on my machine. Visual studio is trying to load the file from 4.0 but not 3.5 (I´ve tried to move the file to 3.5, but that did not work)

Does anyone know what´s wrong here or have any idea what I can do to fix this ?

regards Throstur

like image 970
tingason Avatar asked Jun 05 '12 10:06

tingason


2 Answers

I got the same above error out of the blue.. The project target framework was set to 3.5. Changed it to 4.0 and I was able build successfully.

like image 187
nandan Avatar answered Oct 23 '22 04:10

nandan


All my projects were set to use .NET 4.0, and other answers didn't work for me, but eventually figured it out. Simple:

  1. Right click Visual Studio and "Run as Administrator"
  2. In the newly opened Visual Studio instance, open your solution and run it.

For me, it just worked as expected. Thanks to this answer for helping me figure it out.

like image 36
Adrian Carr Avatar answered Oct 23 '22 04:10

Adrian Carr