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

  • Tuesday, October 05, 2010 3:33 PM
     
     

    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

  • Thursday, October 07, 2010 3:41 AM
    Moderator
     
     

    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 msdnmg@microsoft.com 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Thursday, October 07, 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 08, 2010 2:50 AM
    Moderator
     
     

    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 msdnmg@microsoft.com 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Friday, October 08, 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, September 08, 2011 8:48 PM
     
     

    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.


    • Edited by JMoukel Thursday, September 08, 2011 8:49 PM
    •  
  • Sunday, November 20, 2011 6:05 AM
     
     
    nop, it did not work for me.
  • Thursday, December 29, 2011 1:19 PM
     
     

    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
     
     

    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 07, 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