Microsoft has launched .NET 5.0.4, and they are now calling it “.NET 5”. The last release by Microsoft of their framework was .NET 6 Preview 1 which was not stable, but rather a method for Microsoft to obtain feedback and perfect their products till the final, stable release.
This update includes both security and non-security updates, therefore it is recommended for the users to update their frameworks to the latest build on priority. For that, Microsoft has also created a global command-line tool known as .NET Upgrade Assistant. The scope and functionality of this tool will be discussed further down the post.
1 vulnerability has been addressed with this release. Also, the SDKs accompanying this release are two different versions for two different versions of Visual Studio support, as .NET 5 is a more unified tool that combines .NET Framework, .NET Core, and Mono/Xamarin.
If you are running Windows 10 version 1809 or higher, you will probably have .NET Framework 4.8. You can manually upgrade to .NET 5.0.4 using the download links provided below. You can also upgrade your app to .NET 5 regardless of which version of Framework they are currently on.
- 1 New features and improvements in .NET 5.0.4
- 2 Supported Operating Systems/Requirements
- 3 Download .NET 5.0.4
- 4 Installing .NET 5.0.4
- 5 How to upgrade applications using .NET Upgrade Assistant
- 6 Closing words
- 7 Continue Reading:
Let us continue to discuss in detail what .NET 5 brings.
New features and improvements in .NET 5.0.4
This update includes both security and non-security updates. Let’s see what those are:
Updated Docker images
You can now run the latest releases of .NET and Docker together using the command below:
docker run --rm mcr.microsoft.com/dotnet/samples
To check out more examples of recent updates made to Docker images, click here. Furthermore, the following repositories have also been updated:
- dotnet/sdk: .NET SDK
- dotnet/aspnet: ASP.NET Core Runtime
- dotnet/runtime: .NET Runtime
- dotnet/runtime-deps: .NET Runtime Dependencies
- dotnet/samples: .NET Samples
Microsoft made similar changes in their last stable release .NET 5.0.3. It seems that they are continuously working on enhancing the Docker experience for their consumers.
Update to fix Remote Code Execution vulnerability
Microsoft has also released security advisories for CVE-2021-26701 (.NET Core Remote Code Execution Vulnerability). Guidance for developers to protect their applications and remove these vulnerabilities is also included.
According to Microsoft, a Remote Code Execution vulnerability exists in .NET 5 and .NET Core due to how text encoding is performed.
Supported Operating Systems/Requirements
.NET 5 can be installed on Windows 10 v1703 or higher. This is because it is only compatible with Visual Studio 2019 16.8 Preview 4 and above. Since the mentioned Visual Studio 2019 is only compatible with the following Operating Systems, the .NET 5.0.4 also only supports the following variants of Windows and Server:
- Windows 10 version 1703 or higher. Editions: Home, Professional, Education, and Enterprise (LTSC and S are not supported)
- Windows Server 2019. Editions: Standard and Datacenter
- Windows Server 2016. Editions: Standard and Datacenter
- Windows 8.1 (with Update KB2919355). Editions: Core, Professional, and Enterprise
- Windows Server 2012 R2 (with Update KB2919355). Editions: Essentials, Standard, Datacenter
- Windows 7 SP1 (with latest Windows Updates) Editions: Home Premium, Professional, Enterprise, Ultimate
Moreover, binaries are also available for x86, x64, ARM64, macOS, and Linux systems.
Download .NET 5.0.4
Use the direct download links below to download the .NET 5.0.4 Runtime and SDKs, according to your Operating System and architecture:
For Visual Studio 2019 v16.9 support
For Visual Studio 2019 v16.8 support
More download and install options here.
Installing .NET 5.0.4
Now that you have downloaded the respective installation package, you can begin to install it. The installation of the .NET 5.0.4 is an easy process. Download the file from the links provided above and execute it for installation.
Once you have installed it, all your applications will run using the new build as the previous version will be replaced.
- Run the installation package by double-clicking it (in the case of macOS and Windows), and then clicking Install on the installation wizard.
- The installation will now begin. It does not take much time nor does it require a restart. Click Close once it has been installed successfully.
You have now installed the .NET 5.0.4. You may check which .NET version is running by typing in the following command in Command Prompt:
wmic product get description | findstr /C:.NET
How to upgrade applications using .NET Upgrade Assistant
The .NET Upgrade Assistant is a newly-launched global command-line tool that assists developers to upgrade their apps on older .NET Frameworks to .NET 5. The tool automates the process so that less time is spent on the upgrade and more time is spent on productivity.
We heard from customers that they want to upgrade, but it’s currently too time consuming with our current set of porting tools, particularly for large ASP.NET applications.Microsoft
It is the perfect tool to speedily upgrade your existing applications. Let us try to understand how the Upgrade Assistant works.
How .NET Upgrade Assistant works
As we said, Upgrade Assistant is a command-line tool that needs to be executed and told what to do. However, it still has a process of its own it needs to go through to upgrade your application to an older Framework to .NET 5. Here is a list of the processes it performs, in the exact same order:
- Backup your project(s): To begin, the tool backs up your existing project so you can restore it in case things go sideways.
- Update the projects to be SDK-style projects: Since .NET 5 has a different file architecture format than .NET Framework, you need to convert the existing files to a new format.
- Update the target framework: The tool will now re-target the projects to .NET 5.
- Update NuGet packages for your projects: The NuGet package dependencies will now be updated to the versions that are compatible with .NET 5.
- Add template files: For application models like ASP.NET, common template files are usually missing in the older .NET Framework. These will be added to this step.
- Update C# source: Here, the Upgrade Assistant will offer ASP.NET analyzers which will apply fixes to known patterns that were in .NET Framework that have .NET 5 equivalents.
- Move to next project: In case your app is built on multiple projects, you will now switch to the next project and perform the exact same steps all over again.
Although this may seem like a cool process, some minor tweaks are required manually after the update process has been performed. You can find more guidance on what these manual steps are here in Microsoft’s video guide.
Download and use .NET Upgrade Assistant
You can download and install the .NET Upgrade Assistant as any other .NET tool: from the command line. Before you be, ensure that you have MSBuild installed on your PC. An easy way to do this is to install Visual Studio 2019 on your device.
Once done, enter the following command in PowerShell with administrative privileges to install Upgrade Assistant.
dotnet tool install -g upgrade-assistant
After installation, ensure that it is up to date by running the following command:
dotnet tool update -g upgrade-assistant
Now that the tool has been installed and updated, all you need to do is use it to upgrade your applications to .NET 5. Use the command below to do so:
In the command above, replace PathToCSProjOrSLN with the complete path to the project you want to upgrade, as in the example below:
You will now be taken to the menu where you will perform the steps we have discussed in the “How .NET Upgrade Assistant works” section.
Perform all of the steps on all the projects involved in the app, perform the manual tweaks provided in the guide by Microsoft and your app will now be updated to .NET 5.
We recommend that if you were previously using .NET Framework to develop your applications, you should update them to the latest version right now using the Upgrade Assistant.
Although it may require some additional manual steps to perform, you will benefit from performance gains as well as cutting down computing costs.
We must warn you that some might experience issues that their older binaries may not be compiling after updating to .NET 5. A possible solution to this issue is to also install runtime.json as well. Do leave feedback and let us know if this solution worked for you or not if you encountered any problems in the first place.