Skip to main content Skip to footer

Introducing New Support for .NET 5 and .NET Core 3.1

GrapeCity Spread.NET v14 includes new controls for .NET Core 3.1 and .NET 5 Windows Forms, available now in NuGet. These controls also support the .NET 4.5.2 target so that you can use them across all supported platforms. Spread. NET v14 includes new full-framework controls that use the same API. Create new projects using the full-framework controls with full design-time support, and create parallel projects for .NET Core or .NET 5 using the same source to build against the new controls, assuming your code's portability. Use the Microsoft Portability Analyzer tool to determine the portability of your code to the new platforms.

Note that the new Spread. NET v14 controls for .NET Core 3.1 and .NET 5 Windows Forms do not support design-time in Visual Studio like the full- framework Spread. NET 14 Windows Forms controls.

We recommend using the full-framework controls for development when you want to use the full design-time feature set of Spread. NET 14 in Visual Studio, such as using the Spread Designer tool to design your spreadsheet.

You can create a similar project for .NET Core 3.1 or .NET 5 in the solution and build the same source for those targets.

Porting Projects to .NET Core 3.1 and .NET 5

To show how to port your existing projects using Spread. NET 13 Windows Forms (or earlier versions) to use the new Spread. NET 14 Windows Forms NuGet package controls to target .NET Core 3.1 or .NET 5, I will use one of the demo sample projects, Annual Financial Report:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 1 Annual Financial Report demo sample

This demo sample is installed with the product for both C# and VB. NET. I will focus on the C# solution located under the install folder in Samples\C#\Spread.Examples\GrapeCity.AnnualFinancialReport\GrapeCity.AnnualFinancialReport.sln
and use Microsoft Visual Studio Enterprise 2019 Preview (Version 16.8.0 Preview 4.0):

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 2 GrapeCity.AnnualFinancialReport.sln

Solutions containing more than one project and project dependencies, like this sample, should be handled bottom-up. Start with the dependent projects that have no dependencies, then the projects that depend on those. To avoid potential conflicts with bin and obj folders, create the new netcore3.1 projects in new subfolders located under the folder containing the associated .NET full-framework project.

Step 1: Create folders for new netcore3.1 projects

Create the following new folders (using Windows Explorer):

  • Samples\C#\Common\Spread.Common.DataStore\netcore
  • Samples\C#\Common\Spread.Common.Features\netcore
  • Samples\C#\Spread.Examples\GrapeCity.AnnualFinancialReport\netcore

These new folders will be in the save location for the new netcore3.1 project files that we create next.

Step 2: Create the Project Spread.Common.DataStore.Core

For this step, go to the folder Samples\C#\Common\Spread.Common.DataStore and open the Spread.Common.DataStore.csproj that is being ported in Notepad (or another text editor). This action will be useful for copying into the new project file in the next step.

Using Notepad or another text editor, create a new file and paste this baseline content for the new Spread.Common.DataStore.Core project:

Spread.Common.DataStore.Core.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFraneworks>
    <UseWindowsForms>true</UseWindowsForms>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <AssemblyName>Spread.Common.DataStore.Core</AssemblyName>
    <RootNamespace>Spread.Common.DataStore</RootNamespace>
  </PropertyGroup>
</Project>

Next, add all the files and resources included in the original project. Find the block inside the Spread.Common.DataStore.csproj containing the source and resource files (< ItemGroup > containing < Compile Include=... > or < Content Include=... >) and copy it to the new project. For each source path pasted, insert ..\ in front of the path to fix-up the file path for the new project file location relative to the source files:

Spread.Common.DataStore.Core.csproj 

<Project Sdk="Microsoft.NET.Sdk"> 
  <PropertyGroup> 
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks> 
    <UseWindowsForms>true</UseWindowsForms> 
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo> 
    <AssemblyName>Spread.Common.DataStore.Core</AssemblyName> 
    <RootNamespace>Spread.Common.DataStore</RootNamespace> 
  </PropertyGroup> 
  <ItemGroup> 
    <Compile Include="..\DataSourceEntities\COGSDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\DashBoardDataSource.cs" /> 
    <Compile Include="..\DataService.cs" /> 
    <Compile Include="..\DataSourceEntities\FinancialKPIDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\IncomeStatementDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\JsonDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\KPIDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\AccessDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\OrderEntryDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\StudentCalendarDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\StudentDashboardDataSource.cs" /> 
    <Compile Include="..\GCVersion35.cs" /> 
    <Compile Include="..\Model\AbsenceSchedule.cs" /> 
    <Compile Include="..\Model\AbsentRecord.cs" /> 
    <Compile Include="..\Model\BusinessExpense.cs" /> 
    <Compile Include="..\Model\BusinessRevenue.cs" /> 
    <Compile Include="..\Model\BusinessStat.cs" /> 
    <Compile Include="..\Model\COGS.cs" /> 
    <Compile Include="..\Model\Company.cs" /> 
    <Compile Include="..\Model\Customer.cs" /> 
    <Compile Include="..\Model\CustomerTarget.cs" /> 
    <Compile Include="..\Model\DashBoardItems.cs" /> 
    <Compile Include="..\Model\Employee.cs" /> 
    <Compile Include="..\Model\FinancialKPI.cs" /> 
    <Compile Include="..\Model\Interfaces\IStudentRecord.cs" /> 
    <Compile Include="..\Model\Interfaces\IDateTime.cs" /> 
    <Compile Include="..\Model\Invoice.cs" /> 
    <Compile Include="..\Model\InvoiceParts.cs" /> 
    <Compile Include="..\Model\InvoiceServices.cs" /> 
    <Compile Include="..\Model\KPIList.cs" /> 
    <Compile Include="..\Model\LastSomeMatchStatus.cs" /> 
    <Compile Include="..\Model\MarketSale.cs" /> 
    <Compile Include="..\Model\Match.cs" /> 
    <Compile Include="..\Model\MatchPointTable.cs" /> 
    <Compile Include="..\Model\MovieRecord.cs" /> 
    <Compile Include="..\Model\Parts.cs" /> 
    <Compile Include="..\Model\Product.cs" /> 
    <Compile Include="..\Model\Region.cs" /> 
    <Compile Include="..\Model\Sale.cs" /> 
    <Compile Include="..\Model\ScoreRecord.cs" /> 
    <Compile Include="..\Model\Student.cs" /> 
    <Compile Include="..\Model\StudentSchedule.cs" /> 
    <Compile Include="..\Model\TardyRecord.cs" /> 
    <Compile Include="..\Model\Team.cs" /> 
    <Compile Include="..\Model\TermSession.cs" /> 
    <Compile Include="..\Model\Vehicle.cs" /> 
    <Compile Include="..\Properties\AssemblyInfo.cs" /> 
    <Compile Include="..\Utilities\FileUtilities.cs" /> 
  </ItemGroup> 
  <ItemGroup> 
    <Content Include="..\Data\AbsenceSchedule.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AbsentRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AgingReportCustomers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AgingReportInvoices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\BusinessStats.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Companies.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Customers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\CustomerTarget.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardCustomers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardInvoices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardTargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Employee.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\movie_data.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\FinancialKPIList.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\FinancialTargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Invoice.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\InvoiceParts.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\InvoiceServices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\KPIList.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MarketSales.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchCurrentYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchFourthLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchSecondLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchThirdLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Parts.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Products.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Regions.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Sales.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\ScoreRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Students.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TardyRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Team.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TermSessions.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Vehicle.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Resources\GrapeCity.thmx"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    </ItemGroup> 
    <ItemGroup> 
    <Content Include="..\Data\fpnorthwinds.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\fpWine.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Nwind.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Patients2000.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 

Step 3: Add Form Resources

Resource files for forms are automatically included for the older csproj and vbproj project types. If the project contains any forms, add the resources for each form inside the < Project >< /Project >:

Form Resource Example
<EmbeddedResource Include=*..\Form.resx*>
  <DependentUpon>Form.cs</DependentUpon>
</EmbeddedResource>

Search the project folders for resx files that are not explicitly referenced in the new project, and add each resx and the cs for the associated form as shown above. In this example, there is no such form resx to add in any of the projects, but your projects might contain such resx files, and if those are not included, then you might get errors when you get to Step 9 and try to run the project. In that case, you can usually fix the problem by adding the missing resource in the appropriate project.

Save the file as Samples\C#\Common\Spread.Commom.DataStore\netcore\Spread.Common.DataStore.Core.csproj.

Please Note: You must also save the design-time changes applied using earlier releases of Spread. NET WinForms (v13 and earlier) using v14 to update some classes that are used to serialize the control. Some classes that were previously serializable in earlier versions of the .NET Framework are no longer serializable in .NET 5. This process is also necessary for any Spread XML files saved using earlier releases. Please note that the XML file format has been deprecated, and it is recommended that you use XLSX format with the Exchangeable flag.

Step 4: Create the project Spread.Common.Features.Core

Repeat Steps 2-3 to create the new project Spread.Common.Features.Core, using Samples\C#\Common\Spread.Common.Features\Spread.Common.Features.csproj to copy the source and this template to create the initial empty project file:

Spread.Common.Features.Core.csproj 

<Project Sdk="Microsoft.NET.Sdk"> 
  <PropertyGroup> 
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks> 
    <UseWindowsForms>true</UseWindowsForms> 
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo> 
    <AssemblyName>Spread.Common.Features.Core</AssemblyName> 
    <RootNamespace>Spread.Common.Features</RootNamespace> 
  </PropertyGroup> 
</Project>

Copy the source and resource files (< ItemGroup > containing < Compile Include=... > or < Content Include=... >) from Samples\C#\Common\Spread.Common.Features\Spread.Common.Features.csproj:

 Spread.Common.Features.Core.csproj

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> 
  <PropertyGroup> 
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks> 
    <UseWindowsForms>true</UseWindowsForms> 
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo> 
    <AssemblyName>Spread.Common.Features.Core</AssemblyName> 
    <RootNamespace>Spread.Common.Features</RootNamespace> 
  </PropertyGroup> 
  <ItemGroup> 
    <Compile Include="..\DataSourceEntities\COGSDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\DashBoardDataSource.cs" /> 
    <Compile Include="..\DataService.cs" /> 
    <Compile Include="..\DataSourceEntities\FinancialKPIDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\IncomeStatementDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\JsonDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\KPIDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\AccessDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\OrderEntryDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\StudentCalendarDataSource.cs" /> 
    <Compile Include="..\DataSourceEntities\StudentDashboardDataSource.cs" /> 
    <Compile Include="..\GCVersion35.cs" /> 
    <Compile Include="..\Model\AbsenceSchedule.cs" /> 
    <Compile Include="..\Model\AbsentRecord.cs" /> 
    <Compile Include="..\Model\BusinessExpense.cs" /> 
    <Compile Include="..\Model\BusinessRevenue.cs" /> 
    <Compile Include="..\Model\BusinessStat.cs" /> 
    <Compile Include="..\Model\COGS.cs" /> 
    <Compile Include="..\Model\Company.cs" /> 
    <Compile Include="..\Model\Customer.cs" /> 
    <Compile Include="..\Model\CustomerTarget.cs" /> 
    <Compile Include="..\Model\DashBoardItems.cs" /> 
    <Compile Include="..\Model\Employee.cs" /> 
    <Compile Include="..\Model\FinancialKPI.cs" /> 
    <Compile Include="..\Model\Interfaces\IStudentRecord.cs" /> 
    <Compile Include="..\Model\Interfaces\IDateTime.cs" /> 
    <Compile Include="..\Model\Invoice.cs" /> 
    <Compile Include="..\Model\InvoiceParts.cs" /> 
    <Compile Include="..\Model\InvoiceServices.cs" /> 
    <Compile Include="..\Model\KPIList.cs" /> 
    <Compile Include="..\Model\LastSomeMatchStatus.cs" /> 
    <Compile Include="..\Model\MarketSale.cs" /> 
    <Compile Include="..\Model\Match.cs" /> 
    <Compile Include="..\Model\MatchPointTable.cs" /> 
    <Compile Include="..\Model\MovieRecord.cs" /> 
    <Compile Include="..\Model\Parts.cs" /> 
    <Compile Include="..\Model\Product.cs" /> 
    <Compile Include="..\Model\Region.cs" /> 
    <Compile Include="..\Model\Sale.cs" /> 
    <Compile Include="..\Model\ScoreRecord.cs" /> 
    <Compile Include="..\Model\Student.cs" /> 
    <Compile Include="..\Model\StudentSchedule.cs" /> 
    <Compile Include="..\Model\TardyRecord.cs" /> 
    <Compile Include="..\Model\Team.cs" /> 
    <Compile Include="..\Model\TermSession.cs" /> 
    <Compile Include="..\Model\Vehicle.cs" /> 
    <Compile Include="..\Properties\AssemblyInfo.cs" /> 
    <Compile Include="..\Utilities\FileUtilities.cs" /> 
  </ItemGroup> 
  <ItemGroup> 
    <Content Include="..\Data\AbsenceSchedule.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AbsentRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AgingReportCustomers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\AgingReportInvoices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\BusinessStats.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Companies.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Customers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\CustomerTarget.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardCustomers.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardInvoices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\DashBoardTargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Employee.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\movie_data.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> <
    Content Include="..\Data\FinancialKPIList.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\FinancialTargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Invoice.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\InvoiceParts.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\InvoiceServices.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\KPIList.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MarketSales.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchCurrentYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchFourthLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchSecondLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\MatchThirdLastYear.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Parts.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Products.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Sales.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\ScoreRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Students.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TardyRecords.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TargetMaster.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Team.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\TermSessions.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Vehicle.json"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Resources\GrapeCity.thmx"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
  </ItemGroup> 
  <ItemGroup> 
    <Content Include="..\Data\fpnorthwinds.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\fpWine.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Nwind.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\Patients2000.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    <Content Include="..\Data\receivables.mdb"> 
      <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
  </ItemGroup> 
</Project> 

Save the file as Samples\C#\Common\Spread.Common.Features\netcore\Spread.Common.Features.Core.csproj.

Step 5: Create Project GrapeCity.AnnualFinancialReport.Core

Repeat Steps 2-3 to create the new project GrapeCity.AnnualFinancialReport.Core, using Samples\C#\Examples\GrapeCity. AnnualFinancialReport\GrapeCity.AnnualFinancialReport.csproj to copy the source and this template to create the initial empty project file:

GrapeCity.AnnuaFinancialReportCore.csproj  

 <Project Sdk="Microsoft.NET.Sdk"> 
  <PropertyGroup> 
    <OutputType>WinExe</OutputType> 
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks> 
    <UseWindowsForms>true</UseWindowsForms> 
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo> 
    <AssemblyName>GrapeCity.AnnualFinancialReport.Core</AssemblyName> <RootNamespace>GrapeCity.AnnualFinancialReport</RootNamespace> 
  </PropertyGroup> 
</Project>

Next, copy the source and resource files (< ItemGroup > containing < Compile Include=... > or < Content Include=... >) from Samples\C#\Examples\Grape City.AnnualFinancialReport\GrapeCity.AnnualFinancialReport.csproj:

GrapeCity.AnnualFinancialReport.Core.csproj 

<Project Sdk="Microsoft.NET.Sdk"> 
  <PropertyGroup> 
    <OutputType>WinExe</OutputType> 
    <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks> 
    <UseWindowsForms>true</UseWindowsForms> 
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo> 
    <AssemblyName>GrapeCity.AnnualFinancialReport.Core</AssemblyName> <RootNamespace>GrapeCity.AnnualFinancialReport</RootNamespace> 
  </PropertyGroup> 
  <ItemGroup> 
    <Compile Include="..\AnnualFinancialReport.cs"> 
      <SubType>UserControl</SubType> 
    </Compile> 
    <Compile Include="..\AnnualFinancialReport.Designer.cs"> 
      <DependentUpon>AnnualFinancialReport.cs</DependentUpon> 
    </Compile> 
    <Compile Include="..\Form1.cs"> 
      <SubType>Form</SubType> 
    </Compile> 
    <Compile Include="..\Form1.Designer.cs"> 
      <DependentUpon>Form1.cs</DependentUpon> 
    </Compile> 
    <Compile Include="..\Program.cs" /> 
    <Compile Include="..\Properties\AssemblyInfo.cs" /> 
    <EmbeddedResource Include="..\AnnualFinancialReport.resx"> 
      <DependentUpon>AnnualFinancialReport.cs</DependentUpon> 
    </EmbeddedResource> 
    <EmbeddedResource Include="..\Properties\licenses.licx" /> 
    <EmbeddedResource Include="..\Properties\Resources.resx"> 
      <Generator>ResXFileCodeGenerator</Generator> 
      <LastGenOutput>Resources.Designer.cs</LastGenOutput> 
      <SubType>Designer</SubType> 
    </EmbeddedResource> 
    <Compile Include="..\Properties\Resources.Designer.cs"> 
      <AutoGen>True</AutoGen> 
      <DependentUpon>Resources.resx</DependentUpon> 
      <DesignTime>True</DesignTime> 
    </Compile> 
    <None Include="..\Properties\app.manifest" /> 
    <None Include="..\Properties\Settings.settings"> 
      <Generator>SettingsSingleFileGenerator</Generator> 
      <LastGenOutput>Settings.Designer.cs</LastGenOutput> 
    </None> 
    <Compile Include="..\Properties\Settings.Designer.cs"> 
      <AutoGen>True</AutoGen> 
      <DependentUpon>Settings.settings</DependentUpon> 
      <DesignTimeSharedInput>True</DesignTimeSharedInput> 
    </Compile>
    <None Include="..\Resources\AnnualFinancialReport.xlsx" /> 
    <None Include="..\Resources\ExcelCompatibility.imp" /> 
  </ItemGroup> 
</Project> 

Save the file as Samples\C#\Examples\GrapeCity.AnnualFinancialReport\netcore\GrapeCity.AnnualFinancialReport.Core.csproj.

Step 6: Add New Projects in GrapeCity.AnnualFinancialReport.sln

Create a new folder in the solution named netcore. Add each of the new projects into the solution under that folder:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 3 Add new projects to the solution

Step 7: Add New Project References

The project Spread.Common.DataStore.Core requires some package references. To add those references, expand that project in Solution Explorer and right-click the Dependencies node. Select Manager NuGet Packages... to open NuGet Package Manager, check the box for "Include Prerelease" and use the Browse tab to search for Newtonsoft.Json and System.Data.OleDb packages. Install the latest version of each from nuget.org. The Installed tab should look like this:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 4 Add Newtonsoft.Json and System.Data.OleDb packages to Spread.Common.DataStore.Core from NuGet

The project GrapeCity.AnnualFinancialReport.Core requires both of the other projects Spread.Common.DataStore.Core and Spread.Common.Features.Core. Use Add Project Reference... to add references to those projects:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 5 GrapeCity.AnnualFinancialReport.Core references projects Spread.Common.DataStore.Core and Spread.Common.Features.Core

Use NuGet Package Manager to add the reference for GrapeCity.Spread.WinForms:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 6 Add GrapeCity.Spread.WinForms package to GrapeCity.AnnualFinancialReport.Core from Nuget

Step 8: Organize Project Folders and Mirror Original Project Structure

The last step involves organizing all the project source and resource file links in the new projects to match the organization and structure in the original projects, including all project folders and subfolders.

The GrapeCity.Common.DataStore project has many subfolders organizing the source and resource files (Properties, Data, DataSourceEntities, Model, etc.) that must be created inside the new GrapeCity.Common.DataStore.Core project. Each file link must be moved to the appropriate folder to match the organization of the original project. Right-click the project and use Add New Folder to create the folders, then drag-and-drop the source and resource file links to the appropriate locations. The result should look like this:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 7 Spread.Common.DataStore.Core organized

The GrapeCity.Common.Features project also has many subfolders and requires a similar organization. Follow the steps above to make GrapeCity.Common.Features.Core mirror the structure of GrapeCity.Common.Features. The result should look like this:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 8 Spread.Common.Features.Core organized

The GrapeCity.AnnualFinancialReport project has only two subfolders, Properties, and Resources, so it is easier to organize. The result should look like this:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 9 GrapeCity.AnnualFinancialReport.Core organized

Step 9: Build and Run

Now the new netcoreapp3.1 projects should be ready to build and run. Right-click the GrapeCity.AnnualFinancialReport.Core project and select Set as Startup Project. Press F5 to start debugging, and the project should run without issues:

Introducing New Support for dotNET 5 and dotNET Core 3point1

Figure 10 GrapeCity.AnnualFinancialReport.Core running

If you get errors, there is likely a missing resx file associated with a form that was not included in the new csproj or vbproj that needs to be added in Step 3.

Porting VB Projects to .NET Core 3.1 and .NET 5

Porting VB projects works the same, except using the file type csproj instead of vbproj, and sometimes using different folder names (e.g., My Project instead of Properties), but otherwise, the same steps apply. The sample projects linked below include both C# and VB versions for reference.

Using Design Time

Design time is not yet well-supported for the new platform controls, so continue using the full-framework version and the full-framework projects for design-time. The Spread Designer and the Properties window with all built-in type converters and type editors are available to the developer in design-time using the older csproj and vbproj project types. All changes will be automatically applied to the .NET 5, and .NET Core 3.1 builds for those projects.

Ported .NET Core 3.1 and .NET 5 Samples

After extracting the ZIP file, the solution file (SLN) is located here: Spread.Examples\GrapeCity.AnnualFinancialReport\GrapeCity.AnnualFinancialReport.sln.

Download Now!<%/if%>
Sean Lawyer

Sean Lawyer

Product Manager
comments powered by Disqus