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

前端 未结 21 2935
谎友^
谎友^ 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:58

    I had this problem in Visual Studio 2013 when going from .NET 4.5 to .NET 4.6.2. The problem project was a website project.

    Visual Studio automatically runs some tool which generates Reference.svcmap. The Reference.cs starts with:

    //------------------------------------------------------------------------------
    // 
    //     This code was generated by a tool.
    //     Runtime Version:4.0.30319.42000
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // 
    //------------------------------------------------------------------------------
    

    Just picking the new .NET version caused Visual Studio to clean out the generated files and not fill the contents back. I tried all the solutions above but none worked. Eventually I picked .NET 4.5.1 followed by .NET 4.6.2 and the tool did run. The difference in the files was only the version number of the tool which was in a comment, so I could have recovered the files from GIT.

提交回复
热议问题