How can I update my project from System.runtime 4.0.10.0 to 4.0.20.0

c# entity-framework-core visual-studio-2015

Question

I get this error when I build my project:

Severity Code Description Project File Line Error CS1705 Assembly 'EntityFramework.Core' with identity 'EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' TaaS.DataAccess..NET Platform C:_REPOSITORIES\taas-application\TaaS-WebApplication\TaaS.DataAccess\TaaSContext.cs 8

How can I update from System.runtime 4.0.10.0 to 4.0.20.0 ?

That is my project.json file:

{
  "version": "1.0.0-*",
  "description": "TaaS.DataAccess Class Library",
  "authors": [ "LisaTatum" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "System.Collections": "4.0.10-beta-23019",
    "System.Linq": "4.0.0-beta-23019",
    "System.Threading": "4.0.10-beta-23019",
    "System.Runtime": "4.0.10-beta-23019",
    "Microsoft.CSharp": "4.0.0-beta-23019",
    "EntityFramework.SqlServer": "7.0.0-beta7",
    "EntityFramework.Commands": "7.0.0-beta7",
    "EntityFramework.Relational": "7.0.0-beta5"


  },


  "frameworks": {
    "dotnet": { }
  }
}

I went to the nuget package manager and searched for updateable packages and there was System.Runtime 4.0.20.0. I updated it and from now on everything is broken thanks to Microsoft. I know its beta but that should not happen:

Severity    Code    Description Project File    Line
Warning     Dependency specified was System.Runtime >= 4.0.20 but ended up with System.Runtime 4.0.10-beta-23019.   TaaS.DataAccess C:\_REPOSITORIES\taas-application\TaaS-WebApplication\TaaS.DataAccess\project.json  13

Accepted Answer

I believe if you update your project.json as follows it will solve the error:

{
  "version": "1.0.0-*",
  "description": "TaaS.DataAccess Class Library",
  "authors": [ "LisaTatum" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {

    "EntityFramework.SqlServer": "7.0.0-beta7",
    "EntityFramework.Commands": "7.0.0-beta7"

    }

  "frameworks": {
    "dnx451": { },
    "dnxcore50" : {
      "dependencies": {
        "System.Collections": "4.0.11-beta-23225",
        "System.Data.Common": "4.0.1-beta-23225",
        "System.Linq": "4.0.1-beta-23225",
        "System.Runtime": "4.0.21-beta-23225",
        "Microsoft.CSharp": "4.0.1-beta-23225"
       }
    }
  }
}

note that in early beta versions of tooling class library projects were created with the target "dotnet" as you had it but if you create a class library project with the latest beta7 tooling it uses dnx451 and dnxcore50 so that dependencies can be set independently for each framework. The ones labelled beta7 go in the main dependencies because they are needed by both dnx451 and dnxcore50.

Those dependencies which are not labelled as beta7 are only needed for dnxcore50 so I moved them into the dnxcore50 dependencies and also corrected the versions to correspond to beta7 (there is a correspondence even though they are not named beta7). I also removed a couple of references that I think are not needed and perhaps no longer exist as packages for beta7


Popular Answer

If you need to roll the upgrade back, you can do so by typing the following into the Package Manager Console.

Uninstall-Package System.Runtime -Force

and then

Install-Package System.Runtime -Version 4.0.10-beta-23019


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why