none
Visual Studio 2010 - Could not resolve mscorlib for target framework .NET Framework version v=2.0

    Question

  • I have moved to Windows 7 (64 bit)  and have Visual Studio 2010 (Premium) installed. All my projects (web projects) are using .net 2.0. When I try to build the projects I get the following error.

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

    Also, if I try to drag a web control from the toolbox on to the page, I get the same error.

    If I try to add mscorlib as a reference, I get the same error.

    I tried by creating a new web site, with an empty page, I get the same error.

    I tried by creating a new web site using framework 3, 3.5 and 4.  Only framework 4 worked.

    I check that the mscorlib.dll exists for version 2 and yes it does.

    I have checked that the installation of framework 2.0 is fine, and it is.

    I have repaired Visual Studio 2010.

    I have deleted the Temporary ASP.NET files.

    I see there is a lot of same/similar problems, but I don't see any solutions.

    Can anyone help out?

    Many thanks

    Monday, February 07, 2011 10:57 AM

Answers

  • Sorry to hear that it doesn’t work still now. Could you please try to reinstall your OS? After that, please check if .Net Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1 were installed correctly. Download Verification Tool here. Then please try to re-create a new WPF project and try it again.

     

    Thanks,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Wednesday, February 23, 2011 4:43 PM
    Saturday, February 19, 2011 1:10 PM

All replies

  • Hi mblue,

    Thank you for posting.

    Based on my experience, I created a new web application (c#) via VS2008 on my side and migrate this to VS2010. Everything looks in order.

    So I have some questions need to clarify with you.

    1. Have VS2008/VS2005 and VS2010 been installed on the same machine or not?

    2. Could you please create other projects (Winform, WPF, etc.) that targets .NET Framework 2.0/3.0/3.5 via VS2010? Does it work?

    3. Could you please try to turn Windows features (Microsoft .NET Framework 3.5.1) off and on on your machine (OS: Windows 7)? Does it work?

    Additionally, could you please devenv.exe /log to collect VS runtime log file and provide it to us?

    If you have any update, please feel free to let me know.

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 08, 2011 6:54 AM
  • Many thanks, followed your instruction as below

    1. I have only installed VS2010. But I do have SQL 2008 installed (+BI) that also installs VS2008. Although not the full version. I also seem to have VS2005 remote debugger installed.

    2. I can create WinForms, Console application, class libraries with target framework 2, 3 and 3.5 I have also been working with SharePoint 2010 projects which are framework 3.5

    When I created any WPF (user control, custom control or browser application ) and then retarget to client framework 3.5 I get the following
    error messages:  Attempted re-targeting of the project has been canceled. Required assemblies 'WindowsBase', PresentationCore', and 'PresentationFramework' are missing from the target framework.

    TargetFrameworkMoniker: The "HasTRailingSlash" function only accepts a scalar value, but its argument "$(OutputPath)" evaluates to "C:\Users\marikaxl\AppData\Local\Temp;C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files;C:\Windows\Temp;C:\Temp\DTAR_CACOCDOC_3298_4A3D_9EC)_DBFD8306D79F_DTAR" which is not a scalar value. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets

    3. I have turned off 3.5.1 rebooted, turned on rebooted. No difference.

    4. devenv.exe /log - Should I just copy it in? (if I can't find on upload option, will copy it in next reply)

     

     

     

     

    Tuesday, February 08, 2011 11:56 AM
  • I sent the devenv.exe /log result to msdnmg@microsoft.com

    Thank you

    Tuesday, February 08, 2011 12:02 PM
  • Hi mblue,

     

    Could you please send your log file to my mail? v-xugong at microsoft.com

     

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 09, 2011 7:28 AM
  • Hi mblue,

    Thank you for your mail.

    I think I need to take some time to analysis your question. If I have any findings, I'll feel free to let you know.

    Thank you for your patient.

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 10, 2011 11:36 AM
  • Hi mblue,

    The assemblies WindowsBase, PresentationCore and PresentationFramework are referred automatically when you created a new WPF project. If you created WPF project under .NET Framework 3.5, the runtime version of .Net Framework is v2.0.50272.

    It looks that .Net Framework 3.5 Sp1 weren’t installed on your machine correctly.

    Could you please download .Net Framework Verification Tool to verify if all versions of .Net Framework were installed correctly on your machine?

    If it succeeded, I suggest you can check the following suggestions.

    1. Please try to delete ItemTemplatesCache and ProjectTemplatedCache folders on the <driver:>\<visual studio root>\Common7\IDE

    2. Type “devenv.exe /InstallVSTemplates” and “devenv.exe /Setup” at command line.

     

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 11, 2011 3:08 AM
  • Hi,

    Any update?

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 14, 2011 2:08 AM
  • Sorry, was off work..

    I have verified all .net frameworks with the tool, there were no problems.

    Deleted the 2 Cache files and then run the devenv.exe commands like you said.
    Afterwards, I was not able to create a website, none of the templates were there.
    I was also not able to create a web project, (missing templates I suggest) as visual studio shut down each time with error.

    Lucky I made a backup of the Cache files. I restored these... so I am now back to square 1.

    Marika

    Wednesday, February 16, 2011 2:46 PM
  • Hi guy,

    I think you have to uninstall all framework and VS and reinstall them. 'WindowsBase', PresentationCore', and 'PresentationFramework' will be loaded when the project created. This scenario's possibilities, i think it can be due to VS or framework. So the best way, you have to reinstall them first.

    Thanks,

    Thursday, February 17, 2011 2:57 PM
  • I have already done that. Unfortunately some of the .net frameworks come as part of the operating system with Windows 7.
    Friday, February 18, 2011 1:39 PM
  • Sorry to hear that it doesn’t work still now. Could you please try to reinstall your OS? After that, please check if .Net Framework 2.0 SP2, 3.0 SP2 and 3.5 SP1 were installed correctly. Download Verification Tool here. Then please try to re-create a new WPF project and try it again.

     

    Thanks,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Wednesday, February 23, 2011 4:43 PM
    Saturday, February 19, 2011 1:10 PM
  • Not so easy to reinstall the OS. I work for a large organisation and there are procedures to be followed.

    I am a web developer, so I will just have to find a workaround for the time being.

    I know that I am not the only one with such issue, while searching for answers I came across quite a few post with similar issues. None of them had a solution.

    I am suprised this issue hasn't been addressed yet. Or has it?

    Friday, February 25, 2011 9:32 AM
  • Might be a little too late but as I encoutered this problem too and google suggested me to take a look at this page, it might be other clients with this problem will get passed this page too.

    The solution that worked for me was to simple change the Target framework. I changed it to .NET Framework 3.5 and then back to .NET Framework 4.

    How?

    Open your solution and right click the project (One line below your solution). Choose properties. At the tab 'Application' you will find a dropdown with several Target frameworks.

    Hope this solution will help others too! I found this solution by accident :)

    Monday, July 09, 2012 1:18 PM