Converting a .NET Core RC2 Web Application to RTM

After two years in the works, Microsoft has released .NET Core to the public in the last week of June. Prior to that they had released two RC version of the framework and many of the developers like us embraced it and started working with it. To make those projects work in .NET Core 1.0 we need to  make some changes in the project so that it continues to work properly in the RTM version too.

About .NET Core 1.0

.NET Core 1.0 is available for Windows, Linux and MacOS and can be used to create web apps, microservices, libraries and console applications. Along with the release, they have also introduced a new site called dot.net which is a central location for all the information about .NET framework including .NET Core.

The easiest way to install .NET Core 1.0 in your machine is by installing the Visual Studio 2015 with Update 3. If you are not using Visual Studio, then you can go ahead and download the following which meets your requirements

.NET Core SDK - For developing apps with .NET Core and CLI tools

.NET Core - For running apps with .NET Core Runtime

Please refer here for more details for downloads

Upgrading to RTM

Unlike upgrading from RC1 to RC2, the process for RC2 to 1.0 is pretty straight forward and I was able to complete the whole process within 15 minutes for a simple .NET Core MVC application. 

Step 1 : Replace all the references with 1.0.0-rc2-final to 1.0.0 in the project.json file

"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",

to

"Microsoft.AspNetCore.Diagnostics": "1.0.0",		    
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",	

Step 2 : Replace all the 1.0.0-rc2-* or the ones having specific version numbers  like in Microsoft.NETCore.App to 1.0.0

"Microsoft.NETCore.App": {
	"version": "1.0.0-rc2-3002702",
	"type": "platform"
},

to

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

Step 3 : Rename all 1.0.0-preview1-final to 1.0.0-preview2-final

 "tools": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

to

"tools": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

That's all the changes you need in project.json file for the conversion. Apart from this only minor changes are there in the framework. Another major change is that Json.NET has changed and now it uses camel-case out of the box during conversion there by eradicating the use of CamelCase. If you are using Pascal Case then you may need to have a look at this post by Rick Strahl for solving the issue.

Verifying the Changes

After making the change, the first thing you need to restore the latest dependencies targetting .NET Core 1.0. This can be done by executing the dotnet restore command as shown below

After that for compiling and building, let's execute the dotnet run command which will do these two steps at once as shown in the image

Once the compilation is done, the command will self host the application in port# 5000 and we can access the site using the following url in the browser

 


No Comments

Add a Comment