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.
The ComponentOne team has outlined a few reasons .NET developers should consider upgrading to .NET 5:
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. Also, check out our guide on how to test if your app is portable to .NET5.
If you would like to follow along with my very simple example, download my starting sample.
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.
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>
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
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>
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
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.
Update: The ComponentOne WinForms, WPF, Blazor, and ASP.NET Core controls are now all .NET5 ready, as of the 2020 v3 release. This includes designer support and new .NET5-built libraries available for WinForms and WPF. Learn more about the ComponentOne .NET5 controls and roadmap.