How to fix a missing reference to mscorlib in Visual Studio 2010

by Steve French in How To Fix, Software Development on July 26, 2010

Runtime compiling is greatI was trying to update my main app code to utilize the .Net Framework 4.0 and this happened:

The Problem: I could find no obvious way to update the mscorlib reference in my solution, so I decide to simply delete it and add it again, and hope that it magically updates to the most recent version.  This is actually what usually happens with Visual Studio.  However, I delete the mscorlib reference, and I am unable to add it back again, I get the error message telling me that mscorlib is already included in the project.

The Cause: This is a known problem in Visual Studio.

The Solution: I just went into my project (.csproj) file and added the following line

<Reference Include=”mscorlib” />

And that fixed it.  I still have no idea how to make it use the most recent .Net Framework though.

Creative Commons License photo credit: dasapfe

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog