So you've attempted upgrading Visual Studio 2019 to use .NET 5 but not getting the expected outcome? If it's your first time upgrading to .NET Core 5, you probably have followed the instruction from this post: "ASP.NET Core updates in .NET 5 Preview 1, or this post from Steve: UPGRADING FROM ASP.NET CORE 3.1 TO 5.0 (PREVIEW 1)".
Well, you are not alone as I also referred them in an attempt to try out .NET Core 5. The instructions from the those posts were pretty much simple and very much straight forward:
- Install the [https://dotnet.microsoft.com/download/dotnet/5.0](latest .NET 5 SDK)
- Install/Upgrade the latest Visual Studio 2019 Preview
Note: if you already have Visual Studio Installer in your machine, there's no need for you to go to the download page to get the latest version of Visual Studio. Just open the VS Installer and do the update from there.
The installation and everything went smoothly until you tried creating a sample ASP.NET Core app from the default template and found out that version 5.0 was not on the list:
Surprised right? You then start talking to yourself and said "What the Heck!?", went back to the referenced posts and slowly read what's being instructed there to figure out what you've missed. You realized what you did was all correct. Of course, it's just two simple steps right? So you then went back to your machine and then open up the command prompt to verify the version of .NET by running the following command:
and nope, it still gives you the old version of .NET Core. Perhaps, it's still
.NET Core 3.1.
At this point, you start to wonder why it didn't work and start scratching your head. But you're a fighter, and fighter never easily gives up. So you went ahead and start googling about it and then stumble upon this post. Well, you are on the right track as I'm going to point out the possible causes why it happend based on my own experience.
To give you a bit of a context about my setup, I have installed both Visual Studio 2019 Professional and Preview side-by-side on Windows 10 machine. You may have a different setup, but the tips that I'm going to show should still be relevant.
Tip 1: Select the Correct Installer
Make sure that you install the correct .NET 5 SDK Installer based on your OS. This is the very reason why I'm not seeing ASP.NET Core 5.0 in the list when creating a new project. The SDK download page listed all the available installers based on supported OS. For Windows, x64 and x84 bits are available and I installed the wrong installer in the first place - the x84 (Stupid me!).
For windows, the quickest way to identify which installer you should install is by running the following command in the seach box bar:
and it should bring up the following diaglog window which gives you the OS version you're on:
After installing the correct version, I ran again the command
dotnet --version and gave me the expected result:
and finally able to see
ASP.NET Core 5.0 in the list:
Tip 2: Enable .NET Core Previews
If you are not using the PREVIEW version of Visual Studio 2019, chances are you might still not see
ASP.NET Core 5.0 in the list even if you have installed the correct version of .NET SDK 5 installer. To resolve this, just open Visual Studio 2019 and then click on "Continue without code" as shown in the following:
Options..., and under
Preview Features, tick the
Use previous of .NET Core SDK (required restart) checkbox as shown in the following:
Now just restart/close Visual Studio 2019 and you should now be able to see
ASP.NET Core 5.0 in the list when creating a new project from the default templates.
That's it! If you have any other tips that you'd like me to add in the list, please drop them in comments. Thank you and I hope you find this post helpful!