[]
Spread Windows Forms supports .NET 6 platform. If you want to migrate a .NET Framework project to .NET 6 platform, go through the detailed steps mentioned in this topic.
The following steps consider 'GrapeCity.AgingReport' as a sample .NET Framework project which needs to be migrated to .NET 6 platform. You can also locate this project on your system at C:\Program Files (x86)\Mescius\Spread.NET [version]\Windows Forms\[version]\Samples\C#\Spread.Examples\ after you install SpreadWin successfully.
(This section helps you to check if the code in your project is portable and supported on .NET 6 platform. You can ignore this section if you are already clear about the project portability.)
Open the GrapeCity.AgingReport.sln file in Visual Studio 2019 v16.8+.
Click on Extensions > Manage Extensions in Visual Studio 2019 v16.8+ tabs. In Manage Extensions dialog, search for '.NET Portability Analyzer' and download it.
Right click on the GrapeCity.AgingReport solution and click 'Analyze Assembly Portability'.
Save the Analysis report on your system and open it to analyze the portability details of your project.
!type=note
Note: In this example, the Analysis report shows that the Spread.Common.DataStore project is not 100% supported on .NET Core. You can click on the 'Details' tab of report to see that the issues are related to assemblies (Newtonsoft.Json, System.Data.OleDB). Hence, their latest packages will be installed from NuGet in next section.
(In this example, there are 3 projects in the solution where GrapeCity.AgingReport project refers to Spread.Common.DataStore and Spread.Common.Feature project. Hence GrapeCity.AgingReport project will be migrated after migrating the other two projects.)
Right click packages.config in Spread.Common.DataStore project and click 'Migrate packages.config to PackageReference..'.
Click Ok in 'Migrate NuGet format to PackageReference - Spread.Common.DataStore' dialog box.
Right click Spread.Common.DataStore project and click 'Unload Project'. Double click Spread.Common.DataStore in Solution Explorer to view Spread.Common.DataStore.csproj file.
Remove the content of Spread.Common.DataStore.csproj file and copy it in a text file so that Spread.Common.DataStore.csproj file appears blank and you have its backup in a text file.
Add the following code to blank Spread.Common.DataStore.csproj file to change it to project SDK type. Note that the OutputType is "Library" because DataStore project is class library project.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
</Project>
Find the text "PackageReference" in the backup text file and copy the whole ItemGroup to Spread.Common.DataStore.csproj file.
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>11.0.2</Version>
</PackageReference>
</ItemGroup>
Turn off 'auto generate assembly info' by adding below code to Spread.Common.DataStore.csproj file.
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Install the latest versions of Newtonsoft.Json and System.Data.OleDB from NuGet to make sure that they support .NET 6.
Right click Spread.Common.DataStore in Solution Explorer and click on Reload project. The final content of Spread.Common.DataStore.csproj file will look like below:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="System.Data.OleDb" Version="4.7.1" />
</ItemGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Rebuild Spread.Common.DataStore project to observe that the build is successful and the project has been successfully migrated to .NET 6 platform.
You can migrate Spread.Common.Features project to .NET 6 platform in the same way as Spread.Common.DataStore project in above section (except the installation of System.Data.OleDB Nuget package in step 8). The final code of Spread.Common.Features.csproj will look like below:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Rebuild Spread.Common.Features project to observe that the build is successful and the project has been successfully migrated to .NET 6 platform.
You can migrate GrapeCity.AgingReport project to .NET 6 platform in the same way as Spread.Common.DataStore project in above section except the following:
Skip migrating packages.config to PackageReference as GrapeCity.AgingReport does not have packages.config (done in Step 1).
GrapeCity.AgingReport project refers Spread.Common.DataStore and Spread.Common.Features project. Hence, add the ProjectReference to GrapeCity.AgingReport.csproj file from the text backup file (done in Step 6).
Skip installing the latest versions of Newtonsoft.Json and System.Data.OleDB from NuGet (done in Step 8).
The final code of GrapeCity.AgingReport.csproj will look like below:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\Spread.Common.DataStore\Spread.Common.DataStore.csproj">
<Project>{6e4896e5-e77c-4276-93d3-f52cc1d3c4a5}</Project>
<Name>Spread.Common.DataStore</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\Spread.Common.Features\Spread.Common.Features.csproj">
<Project>{08b57d63-d0ad-431a-819a-c3a00f479feb}</Project>
<Name>Spread.Common.Features</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Rebuild GrapeCity.AgingReport project to observe that the build is successful and the project has been successfully migrated to .NET 6 platform.
Select NuGet Package Manager > Manage NuGet Packages for Solution from the Visual Studio 2019 v16.8+Tools tab.
Search 'Grapecity.Spread' and install GrapeCity.Spread.WinForms NuGet package in your solution.
Rebuild the solution to observe that the build is successful. The Grapecity.AgingReport solution is successfully migrated to .NET 6 platform.