Discount for my course: High Performance Coding with .NET Core and C#

Gergely Kalapos


Migrating from ASP.net core RC1 to RC2 - Entity Framework Core

Posted on May 16, 2016



Asp.net core RC2 was officially released a few hours ago. I have a side-project, which I did not update until this point, so I developed on RC1-Update1 basis. The solution is a little bit bigger, it has 8 src projects and 4 tests. Most of them are C# projects and there are also a few F# projects. I have one project for the data access with Entity Framework Core.

There is a great documentation on migrating EF from RC1 to RC2 here. But it still does not show a complete project.json file, and of course I run into some problems.

So what I had was a plain data access project with EF core. I think this is a very common scenario, so I think I'm not the only one doing this and then run into this problem. 

Just by updating the NuGet package names and versions I got error messages like this: 

 Package Ix-Async 1.2.5 is not compatible with netstandard1.5 
(.NETStandard,Version=v1.5). Package Ix-Async 1.2.5 supports: - net40 (.NETFramework,Version=v4.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8 (.NETPortable,Version=v0.0,Profile=Profile78) Package Remotion.Linq 2.0.2 is not compatible with netstandard1.5
(.NETStandard,Version=v1.5). Package Remotion.Linq 2.0.2 supports: - net35 (.NETFramework,Version=v3.5) - net40 (.NETFramework,Version=v4.0) - net45 (.NETFramework,Version=v4.5) - portable-net45+win8+wp8+wpa81
(.NETPortable,Version=v0.0,Profile=Profile259)
One or more packages are incompatible with .NETStandard,Version=v1.5.

And the reason for this is that some imports were missing for netstandard1.5 in project.json.

So... here is the old project.json from RC1:

{
  "version": "1.0.0-*",
  "description": "Data Access for ***",
  "authors": [ "Gergely Kalapos" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "compilationOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
    "EntityFramework.InMemory": "7.0.0-rc1-final",
    "***my-own-package**.******": "1.0.0-*"
  },
 "commands": {
      "run": "***.Data",
       "ef": "EntityFramework.Commands"
  },
  "frameworks": {
    "dnx451": { },
    "dnxcore50": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Console": "4.0.0-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  },
  "configurations": {
    "DebugOffline": {
      "compilationOptions": {
        "define": [ "ISOFFLINE" ]
      }
    }
  }
}

And here is the updated, working one for RC2

{
  "version": "1.0.0-*",
  "description": "Data Access for ***",
  "authors": [ "Gergely Kalapos" ],
  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027",
    "*****my-own-package******": "1.0.0-*",
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.InMemory": "1.0.0-rc2-final"
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  }
}

Note the "imports" part under netstandard1.5. That was the missing piece for me.


;