Share via


How to resolve "Could not resolve mscorlib..."?

Question

Tuesday, October 5, 2010 3:33 PM | 1 vote

Have gone thru all of the existing posts for this problem and (unless I'm missing the point) NO ONE has come up with the definitive solution to this.  All of the posts just seem to end in mid-air.  Is this a case of throwing enough at the wall so something sticks?

The reproduceable problem:

Start with: Visual Web Dev or Visual Studio 2010 > New Project > [C# or VB] > Web > ASP.NET MVC 2 Web Application > (Whir, Whir) > Models/Right Click > Add >New Item > Data > ADO.NET Entity Data Model > Add (Boing!) BIG X "Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted."  After closing error message, VWD stays up and returns to Add New Item - Appname dialog - in other words VWD doesn't crash and burn!

A search shows there are 7 'mscorlib.dll's resident on this machine in the following directories:

  • C:\Program Files\Microsoft Silverlight\4.0.50917.0
  • C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0
  • C:\Program FIles\Reference Assemblies\Microsoft\Framework\NetFramework\v3.5\Profile\Client
  • C:\Program Files\Reference Assemblies\Microsoft\Framework\NETFramework\v4.0
  • C:\Program FIles\Reference Assemblies\Microsoft\Framework\NETFramework\v4.0\Profile\Client
  • C:\Program FIles\MSN Toolbar\UIEngine\4.0.0318.1       -and-
  • C:\Program files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0

All of the info I can find says that 'web.config' defines targetFramework="4.0" which it does.  Another place said there should be TWO values defined for targetFramework but never detailed what they were. 

Verification of Control Panel / Windows Features shows Microsoft .NET Framework 3.5.1 installed (checked).

Programs and Features lists the following:

  1. MS .NET Framework 2.0 SDK - ENU, 10/3/2010, blank, blank
  2. MS .NET Framework 4 Client Profile, 10/3/2010, 38.8 MB, 4.0.30319
  3. MS .NET Framework 4 Extended, 10/3/2010, 51.9 MB, 4.0.30319
  4. MS .NET Framework 4 Multi-Targeting Pack, 10/2/2010, 83.4 MB, 4.0.30319
  5. MS ASP.NET MVC 2, 10/2/2010, 482 KB, 2.0.50217.0
  6. MS ASP.NET MVC 2 - Visual Studio 2010 Tools, 10/3/2010, 2.25 MB, 2.0.50217.0
  7. MS ASP.NET MVC 2 - VWD Express 2010 Tools, 10/2/2010 2.23 MB, 2.0.50217.0
  8. MS VS 2010 ADO.NET Entity Framework Tools, 10/2/2010, 33.4 MB, 10.0.30319
  9. MS VS 2010 Professional - ENU, 10/3/2010, blank, 10.0.30319
  10. MS VS 2010 Tools for Office Runtime (x86), 9/10/2010, blank, 10.0.30319
  11. MS VS Tools for Applications 2.0 - ENU, 0/10/2010, 203 MB, 9.0.35191
  12. MS VWD 2010 Express - ENU, 10/4/2010, blank, 10.0.30319

Environment:

  • HP a6130n PC (AMD 64bit x 2) 4Gb Mem, 500Gb HD
  • Win7 32bit Home Premium (fresh install 9/1/2010)
  • Win Update checked and installed 10/4/2010 (included Security Update for .NET 4)

DevExpress VersionChecker shows frameworks: v2.0.50727 & v4.0.30319 installed. 

Similar problem was occuring with Silverlight 'Could not resolve for 'Silverlight,v3.0'.  I had shortened my login id from fullname to initials, broke Silverlight, returned loginin name to original, problem went away.  Bizarre, Right!

 

At a stand still with VS 2010, may force me back to earlier days.

Frank Towle

All replies (13)

Friday, October 8, 2010 3:05 PM âś…Answered

Right...

Posted in Connect as 'Again {"Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted"}' on 10/1 - will post answer here when it arrives.

Frank Towle


Thursday, October 7, 2010 3:41 AM

Hi Frank,

There is a similar issue happened and reported at https://connect.microsoft.com/VisualStudio/feedback/details/542789/could-not-resolve-mscorlib-for-target-framework-netframework-version-v4-0-this-can-happen-if-the-target-framework-is-not-installed-or-if-the-framework-moniker-is-incorrectly-formatted?wa=wsignin1.0, could you follow the steps to see it applies to your problem?

Otherwise, please try repairing the VS2010 and if the problem persists, you can fire another case on the connect.microsoft.com with more minidump and log information.

Thanks.

Figo Fei
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected] 

Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Thursday, October 7, 2010 1:40 PM

Hi Figo,

Thank you for your response...

You see, this problem just bounces back and forth between 'connect' and 'social' with no real resolution.  The link you provided does NOT show a solution just 'rebuild box from scratch and hope for the best'.  In the almost 50 YEARS I have devoted to IT development projects, this approach would go over like a lead balloon.  There is a root cause and I would expect someone to find it (owning the problem would be too much to ask) and provide a solid resolution/fix.  Sorry. 

My best to you.

Frank Towle


Friday, October 8, 2010 2:50 AM

Hi Frank,

Because memory dump and log could be big in size and your case can be different from the one I posted, the connect website is more efficient to deal with such a case than forum.

To help you find the root cause of such a problem, I suggest you to use connect. If you could post the case connect link back here later, other community members hopefully can see, vote and share their experience on it, so that it benefits the ones who encountered with the same problem in the future.

Thanks for your understanding.

Figo Fei
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected] 

Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Thursday, September 8, 2011 8:48 PM | 2 votes

I solved this problem by downloading and installing .Net Framework 4 from here: http://msdn.microsoft.com/en-us/netframework/aa569263.aspx

It worked like magic.


Sunday, November 20, 2011 6:05 AM

nop, it did not work for me.


Thursday, December 29, 2011 1:19 PM | 1 vote

I was facing same type of  problem but now working fine.

My scenario was that I was developing a custom control for Moss 2007 using visual studio 2010. I have set target frame work 3.5. when i was building the project then i got error-

  *Could not resolve mscorlib for target framework '.NETFramework,Version=v3.5'.  This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted. *      

Solution:

1. Go to the property page of the website

2. set the Before Running start up Page "No Build"

3. Target framework as per the your need for me its 3.5

4. click on apply and build the solution. every things will be fine.

 

All the best


Tuesday, March 27, 2012 2:02 PM | 1 vote

Hi JMoukel

Hallo HALLO THIS IS MAGIC

I saw you post earlier - but i did not believe you.

After trying every thing for days I finally took upon your advise - and it works.

There must be something in that special download that dosent excist in the others.

like you say PURE MAGIC

Thank you

danish Freddy


Friday, June 15, 2012 7:57 AM

I had the same error. What I did:

- I deleted the "obj" folder in the project root.

- I deleted all the "Interop" files in the bin\Debug folder. (the debug output folder)

Problem went away! :)

** Careful! Always make backups before deleting anything, or use recycle bin.


Thursday, February 7, 2013 6:45 AM

Hi,

Same problem,

and i deleted the OBJ folder- then restarted VS 2010

All OK then!

The problem showed up when i  had edited the project on a PC with VS 2012

Best regards

Hans


Monday, February 16, 2015 11:18 AM

Hi,

Same problem.

I was also going between VS2013 and VS2010. 

The issue for me is currently resolved by running visual studio as a different user. 


Thursday, December 10, 2015 3:57 PM

Bless you - thank you!  This worked nice and simple.

- Judy


Monday, December 19, 2016 9:43 AM

I also try and find just because

the folder name of my project is too long(that is the folder path of the project too long), I just shorten some of the folder name in my path and it's solved, I spend 8 hours to find it...

another link for reference 

http://stackoverflow.com/questions/5392925/error-updating-service-references-could-not-resolve-mscorlib-for-target-framewo

http://stackoverflow.com/questions/5498624/visual-studio-2010-could-not-resolve-mscorlib-for-target-framework-netframewo

the last time I met into a similar problem is that, just because there's space in the folder name nthen the project build failed, and just remove the space all is well...