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

前端 未结 21 2850
谎友^
谎友^ 2020-12-14 14:31

We are currently migrating all our solutions from 2005 to 2010 (that\'s right, we\'re skipping 2008!). We are also changing our file structure to make some more sense (some

相关标签:
21条回答
  • 2020-12-14 14:40

    for me, just setting Target Framework 4.0 resolved my problem. Sometimes the target framework is clear somehow. That might cause problem.

    0 讨论(0)
  • 2020-12-14 14:40

    I ran into this issue today in Visual Studio 2017 on a project that I had apparently started out as a Universal Windows Platform application but ultimately settled on a Windows Forms desktop application.

    Somehow, either through a branching mistake or commit problem in source control, some of the obsolete/discarded UWP XAML files, along with a "project.json" file wound up back in my project folder. VS would no longer build or launch my Windows Forms app with a similar error as reported by others above (e.g., "Could not resolve mscorlib for target framework '.NETFramework,Version=v4.7'").

    After deleting all of the obsolete UWP junk (including "project.json", all the XAML files, and any other related nonsense) out of the project folder and reloading the solution, the errors went away and the project both built and launched successfully.

    Hope this helps.

    0 讨论(0)
  • 2020-12-14 14:42

    Check that the target framework in the project properties is set correctly - by default this is ".Net Framework 4.0 Client" - it may be that you require ".Net Framework 4.0"

    see this thread that looks like the same issue

    you may also want to review this article which relates to debugging an issue with the same symptom using reflector

    0 讨论(0)
  • 2020-12-14 14:44

    My solution was to download and install the Microsoft.NETCore.UniversalWindowsPlatform from the NuGet Package Manager

    0 讨论(0)
  • 2020-12-14 14:45

    In most case it happened because of missing reference.
    In solution explorer --> Reference -- > you can see the missing reference (in yellow) just add the reference you will be fine.

    0 讨论(0)
  • 2020-12-14 14:46

    i worked on my project saved the work and closed visual studio 2010. when opened again for working i got this error i just closed visual studio again copied the file where my project was saved and i pasted it somwhere else (in a file on my desktop) and i opened again the project with VS2010 and it was working.

    0 讨论(0)
提交回复
热议问题