Upgrading from ASP.Net Core 1.0 to ASP.Net Core 1.1

We have ASP.Net Core 1.0 along with .Net Core 1.0 SDK for quite some time. Microsoft recently released ASP.Net Core 1.1 along with .Net Core 1.1 SDK. There are many new improvements as part of the new release which includes middlewares like URL Rewriting, Response Caching etc., and improved deployment and hosting capabilities. In this tutorial, we are going to see how to install and get started with ASP.Net Core 1.1.

Lets get started by installing necessary SDK and tools. Download and install latest .Net Core 1.1 SDK – Link.

image

Install latest Visual Studio 2015 Tools – Link.

image

Now open command line prompt and check the .Net Core Version, it should be as shown below.

image

Open VS Community 2015 (Update 3) and create a new ASP.Net Core Web Application Project (In fact we can open projects which are build using ASP.Net Core 1.0 and continue with below upgrading process).

image

Once project is created, VS will restore the nuget packages. Open global.json file and change the version as shown below to target .Net Core 1.1.

"version": "1.0.0-preview2-1-003177"

Open Project.json file and make following version changes to target .Net Core 1.1.

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    /* Remaining Packages are omitted for code brevity */ "frameworks": {
      "netcoreapp1.1": {
        "imports": [
          "dotnet5.6",
          "portable-net45+win8"
        ]
      }
    }
  }

Now lets update the nuget packages. Right click on References and select Manage Nuget Packages.

image

Update all the nuget packages.

image

Manually update the tools versions.

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "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.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
  },

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

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

After making above changes, VS will automatically restore the packages (otherwise we can use dotnet restore as well). Now lets try to build and run the application from command line prompt.

image

image

We can browse to the URL (http://localhost:5000 ) at which app was hosted.

That’s it for now. Happy Coding and Stay tuned!!!

You may also like...