New version of .NET Core 1.1 has been published on 17th November. Together with it new versions of ASP.NET and EntityFramework have been introduced. I wanted to update my application to new framework. I thought that it will be very easy. Unfortunate my application didn’t start after update. Moreover it didn’t even compile.

Let’s start from the beginning. The first thing you need to do is downloading and installing new SDK and Runtime. You will find installers on .NET Core Downloads webpage.

I was very optimistic. I thought that after installation I will need only to update packages by NuGet.

After that action instead of working application I got following compilation errors:

  • 1. The project has not been restored or restore failed – run `dotnet restore`
  • 2. The project does not list one of ‘win10-x64, win81-x64, win8-x64, win7-x64’ in the ‘runtimes’ section.
  • 3. You may be trying to publish a library, which is not supported. Use `dotnet pack` to distribute libraries.
  • Can not find runtime target for framework ‘.NETCoreApp,Version=v1.0’ compatible with one of the target runtimes: ‘win10-x64, win81-x64, win8-x64, win7-x64’.

I tried to run dotnet restore as it was written but it didn’t help. The list of errors looked the same.

project.json

To fix those errors you need to modify two files. Let’s start from project.json. Update of .NET Core libraries will delete information about type. After update your project.json file should look similar to:

{
  "dependencies": {
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.NETCore.App": "1.1.0"
  }

In this file we need to fix entry related to Microsoft.NETCore.App. We need to extend this entry:

"Microsoft.NETCore.App": {
  "version": "1.1.0",
  "type": "platform"},

Moreover we should also update entry related to frameworks:

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "portable-net45+win8"
    ]
  }
} 

So we need to change it into:

"frameworks": {
  "netcoreapp1.1": {
    "imports": [
      "dotnet5.6",
      "portable-net45+win8"
    ]
  }
}

After those modifications our application should compile and work. But this is still not the end.

global.json

global.json contains information about SDK version. It still points on previous version of SDK:

{
  "projects": ["src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

We need to change this file also:

{
  "projects": ["src", "test"],
  "sdk": {
    "version": "1.0.0-preview2-1-003177"
  }
}

Just after this modification you can say that you have update your application to ASP.NET Core 1.1 correctly.