What is .NET 5.0

Microsoft's primary goal with the release of .NET 5.0 is to merge all future .NET development onto one unified .NET platform. All of Microsoft's different development environments, such as WinForms, WPF, ASP. NET, Xamarin, etc. are all moving to .NET Core, which will now be known as ".NET."

.NET 5.0 is technically .NET 5.0 Core, but 5.0 intends to clean up and simplify the terminology for future development in .NET. The version number is skipping straight from 3.0 to 5.0 to prevent confusion due to .NET Framework using the 4.x version numbering for quite some time now. After .NET 5.0, Microsoft's roadmap shows that they plan to keep the versioning simple with yearly major releases every November going from 5.0 to 6.0 to 7.0, and so on.

How to Migrate from dotNET to dotNET 5 Controls

Why Should I Upgrade to .NET 5.0

The ComponentOne team has outlined a few reasons .NET developers should consider upgrading to .NET 5:

  • To be on the cutting edge of Microsoft's platforms
  • To support multiple operating systems from one codebase
  • All platforms will be unified in supporting .NET 5.0
    • Master .NET 5.0, and you can work in any Microsoft platform
      • WinForms, WPF, ASP. NET MVC, Xamarin, etc.
  • Improved performance
  • Two runtime options
  • Java interoperability
  • Objective-C and Swift interoperability
  • New "Half" type
    • A binary floating-point that occupies 16 bits
  • Assembly trimming

Migrating from the .NET Framework to .NET 5.0

Before starting your migration, I recommend checking your project's portability with Microsoft's Portability Analyzer tool. This tool will give you an idea of how much trouble you may or may not have when migrating to .NET 5.0.

If you would like to follow along with my very simple example, you're welcome to download my starting sample.

Step 1: Creating a New Folder for Your .NET Framework Project

Create a new folder inside the main solution folder of your .NET Framework project that will contain the new .NET 5.0 project. Mine will be FlexGridOnNet5.

Step 2: Creating a New File and Adding the Code

Create a new file in the folder and name it yourprojectname.csproj then add the following:

<Project Sdk="Microsoft.NET.Sdk">  
  <PropertyGroup>  
    <TargetFrameworks>net5.0-windows</TargetFrameworks>  
    <UseWindowsForms>true</UseWindowsForms>  
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>  
    <AssemblyName>FlexGridOnNet5 (The name of your new 5.0 project)</AssemblyName>  
    <RootNamespace>FlexGridOnFramework (the name of your solution)</RootNamespace>  
  </PropertyGroup>

</Project>  

Step 3: Adding the .csproj to the Existing Solution

Now let's add the new .csproj file to our existing solution. Open the command line in Visual Studio and use the following command:

dotnet sln add .\FlexGridOnNet5\FlexGridOnNet5.csproj

How to Migrate from dotNET to dotNET 5 Controls

Step 4: Configuring the Project File to Include Code

Now we need to configure the project file to include all the code from our .NET Framework project. Instead of adding lines for each item, we can use this simple snippet to grab everything from the .NET Framework project.

  <ItemGroup>  
    <Compile Include="..\FlexGridOnFramework\**\*.cs" />  
    <EmbeddedResource Include="..\FlexGridOnFramework\**\*.resx" />  
  </ItemGroup>  

Step 5: Adding NuGet Packages

Now we need to add NuGet Packages for anything we were using in our old project. In my case, I'll be adding C1.Win.C1FlexGrid

How to Migrate from dotNET to dotNET 5 Controls

That's it! You can find the finished sample here. Assuming your project doesn't currently rely on any APIs and are only available in .NET Framework, you should be good to go.

Try ComponentOne UI Controls Free for 30 Days

Download the latest version of ComponentOne

Download Now!