Upgrading ASP.NET Core 1.0 RC2 Project To RTM

A month ago I’ve demonstrated,

The migration from Beta to RC2 was a bit long but pretty much easy to follow and I was able to run my prototype apps smoothly without any hiccups. Recently, ASP.NET Core RTM was out. Microsoft announced the release of ASP.NET Core 1.0, couple of days ago. Big thanks to Microsoft and to the .NET Core team for their utmost effort on making this final release. Kudus!

Let’s Get Cracking!

In this article, we’re going to look at how to convert our existing RC2 App to RTM in Windows environment, using Visual Studio 2015.

Installation Requirements

Installing Visual Studio 2015 Update 3

Close all the instances of Visual Studio, which are running on your machine and then install Visual Studio Update 3 (vs2015.3). Now, if you will get the following setup warning below:

Setup Warning
Figure 1: Setup Warning

Don’t panic. Just click continue and it should bring you to the next step, shown below:

Features
Figure 2: Features

Select the features, that you would like to be included for this update and then click “Next”. Verify all the features, you need in the next step and then click “Update” to start applying the changes.

You may need to wait few minutes or a few hours, depending on your connection, before it completes the upgrade. Once completed, you should be able to see the following:

Setup Completed
Figure 3: Setup Completed

After the installation, make sure to restart your machine to ensure updates will take effect.

Installing .NET Core 1.0.0 VS Tooling Preview 2

Now, install the Tooling Preview 2, that you have just downloaded. You should see something like this as the installation progresses.

VS 2015 Tooling Preview 2 installation
Figure 4: VS 2015 Tooling Preview 2 installation

Once the installation is complete, you should be able to see the screenshot, shown below:

VS 2015 Tooling Preview 2 installation completed
Figure 5: VS 2015 Tooling Preview 2 installation completed

Upgrading to RTM

In this demo, I’m going to use the ASP.NET Core MVC project, that I’ve demonstrated before. Now, let’s start modifying.

Note: You may need to run Visual Studio as an administrator to make sure that restoring of NuGet packages will run smoothly.

project.json changes

The fastest trick to upgrade is to create new project and compare your existing “project.json” file with the new project. Looking at the newly created ASP.NET Core Web Application project it seems that we only need to change,

  • The Microsoft.NETCore.App version from 1.0.0-rc2-3002702 to 1.0.0
  • All references from 1.0.0-rc2-final to 1.0.0.
  • All references from 1.0.0-preview1-final to 1.0.0-preview2-final
  • Remove the imports section under the tools element. Hence, your tools element would now look like this,
    1. "tools": {  
    2. "Microsoft.AspNetCore.Server.IISIntegration.Tools""1.0.0-preview2-final"  
    3. },  

So doing a quick find and replace will easily do the sync for you.

global.json changes

You need to update SDK version to 1.0.0-preview2-003121. Hence, your file will look, as shown below:

  1. {  
  2.     "projects": ["src""test"],  
  3.     "sdk": {  
  4.         "version""1.0.0-preview2-003121"  
  5.     }  
  6. }
Wrapping Up

Here’s, how my project.json file looked like after the modification:
  1. {  
  2.     "dependencies":  
  3.     {  
  4.         "Microsoft.NETCore.App":  
  5.         {  
  6.             "version""1.0.0",  
  7.             "type""platform"  
  8.         },  
  9.         "Microsoft.AspNetCore.Server.IISIntegration""1.0.0",  
  10.         "Microsoft.AspNetCore.Server.Kestrel""1.0.0",  
  11.         "Microsoft.AspNetCore.Mvc""1.0.0",  
  12.         "Microsoft.AspNetCore.Diagnostics""1.0.0"  
  13.     },  
  14.   
  15.     "tools":  
  16.     {  
  17.         "Microsoft.AspNetCore.Server.IISIntegration.Tools""1.0.0-preview2-final"  
  18.     },  
  19.   
  20.     "frameworks":  
  21.     {  
  22.         "netcoreapp1.0":  
  23.         {  
  24.             "imports":  
  25.             [  
  26.                 "dotnet5.6",  
  27.                 "dnxcore50",  
  28.                 "portable-net45+win8"  
  29.             ]  
  30.         }  
  31.     },  
  32.   
  33.     "buildOptions":  
  34.     {  
  35.         "emitEntryPoint"true,  
  36.         "preserveCompilationContext"true  
  37.     },  
  38.   
  39.     "runtimeOptions":  
  40.     {  
  41.         "gcServer"true  
  42.     },  
  43.   
  44.     "publishOptions":  
  45.     {  
  46.         "include":   
  47.         [  
  48.             "wwwroot",  
  49.             "web.config"  
  50.         ]  
  51.     },  
  52.   
  53.     "scripts":   
  54.     {  
  55.         "postpublish": ["dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"]  
  56.     }  
Output

That's it! Unlike previous versions, it seems that upgrading to RTM is painless. Here's the output of my ASP.NET Core MVC app after the upgrade:

Output
Figure 6: Output

I have attached the source code of my upgraded ASP.NET Core MVC app just in case you need a reference. Feel free to download it.

If you are still working on Beta versions and wanted to migrate your project to RTM, then I would really recommend you on creating a fresh project instead and move your code to the new project created. In this way, there is a less chance for you to get the migration configuration errors.

I know, there are some things, I haven’t covered in this article as I am only basing my prototype app for this upgrade. For more details about the breaking changes, I would recommend you to visit the following references:  

Up Next
    Ebook Download
    View all
    Learn
    View all