Visual Studio 2010: Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'

It could be that the path to your solution is too long:

Meaning:

C:\MyProject\Folder\SubFolder...

should be Under "256 Character".

http://wcfvs.blogspot.com/2011/04/could-not-resolve-mscorlib-for-target.html

I found this thread when I had the same issue but had no reference issues. I found the link above and it solved my problem. Hopefully this will help someone else who comes here with the same problem.


I was getting this error this morning. I just did the following:

  1. Rebuild the Project
  2. Closed Visual Studio
  3. Re-opened Visual Studio

and the error was gone.


Microsoft Visual Basic for Applications Extensibility 5.3 (VBIDE) is the name of the devil!!!

Apparently this is a reference which my co-worker had somehow, but i didn't and because of this reference, EVERYTHING died. We discovered this because if you check "Show all files" on the specific project (which is a VB.NET project) you get the sweet References folder, which is normally not there for VB.Net project it's seems. Where the Tab failed us, the folder showed us one reference with a warning. Apparently this is something the compiler or VS2010 couldn't tell me but was exactly what was messing it up for us.

So, if you get this error when working on a project, "Show all files" so you get to see the References folder, and find out which reference could be causing your problems!

I'm glad it found this though, after more then 3 hours!! >.<