How to Migrate ASP.NET Core 3.x to ASP.NET 5

As we know that .NET 5 has been launched and this tutorial will advise how to migrate ASP.NET Core 3.1 to ASP.NET 5. Please just make sure you have installed Visual Studio 2019 and updated to latest version 16.8.1.

If you don’t have the updated version, then you can simply select Help -> Check for Updates and from there Visual Studio will handle the rest of update work for you. Follow the installation steps and you should be ready.

You can always install the latest version of Visual Studio 2019 from Microsoft’s Visual Studio Website .

Changing Project Target Framework to .NET 5

Now once you are done from updating Visual Studio, open your solution again and from there right click on your project and choose properties:

Then from the properties window, select the target .NET Framework and choose .NET 5.0

Once the change is applied, press ctrl + s to save your changes and close the properties window.

Now, the project’s target framework has been changed. Try to build the project and see if there are any errors raised, normally there shouldn’t be any.

Updating Project’s Dependencies

The next step here is to check if there are updates on your NuGet packages so that your project stays up-to-date with the latest framework version as well as your dependencies.

Right click on dependecies and choose manage NuGet Packages

Then open the Update tab, there you will see the packages that are available for update for your project

As you can notice, in this project, we have references for 3 packages. We want to update all of them so all our libraries would be targeting the latest .NET framework 5 and benefiting from its great enhancements.

Check the ‘Select all packages’ checkbox and click update. Follow along with the update process and choose Ok and Accept for any dialogs that might popup.

Once this is done, rebuild your project or solution to double-check that there are no errors or warnings

Let’s do a quick peak view on the modified version of the project file to see what we have done on our project, if you are using a source control (like git or something else), it would be super easy to compare the changes on the file with the latest checked-in version

As you can notice, the TargetFramework is now net5.0 and even the dependencies versions are now 5.0.0, even though some other external dependencies versions might not be 5, but that shouldn’t matter, because the versioning of each package is done by the provider it is not imposed by the .NET Framework.

Testing with Postman

Now let’s run and test our application

Open postman and let’s see if the first API, login will work

Yes, it works.

Now let’s test the other endpoint, make sure to copy the response token value from the login endpoint and place it in the authorization header with Bearer prepended as the below

And yes, that is working as well.

Deploying to IIS

If your application is already deployed to an IIS on some Windows Server, you just need to install the new hosting bundle for the ASP.NET Core Runtime 5.0.0 and then you should good to go.


Migrating from ASP.NET Core Web API 3.1 to 5 is an easy task with simple steps to follow. You should be good to go and face no problems at all. If you have doubts to update some external dependency, you can always verify the release notes or official website or GitHub account of the dependency provider for any compatibility or breaking changes or raised issues by other users.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *