Reporting in .NET Core 3 (CTP)
- 5 minutes to read
If your application uses DevExpress Reporting and targets .NET Core 3, you can run it on all supported platforms - WinForms, WPF, and ASP.NET Core.
ASP.NET Core 3 reports maintain feature parity with previous .NET Core versions and use the same Report Designer mechanism. A Visual Studio extension associated with XML report definition files launches the Report Designer and saves your edits to XML. Refer to the ASP.NET Core Reporting documentation section for more information.
Due to limitations in .NET Core 3.0, we are currently unable to integrate the Report Designer into Visual Studio’s design time for WinForms or WPF projects. This topic explains how you can work around this limitation and create reports at design time. This method requires that you create an auxiliary .NET project that links reports available in your .NET Core 3.0 project.
Refer to the Limitations section in this topic for information on the report features that you should avoid when you use the suggested workaround to create reports in desktop applications.
You can also create reports in code.
Visual Studio 2019 latest version with the .NET desktop development workload
Create a New or Migrate Existing Project
Create a New .NET Core 3 Project
Open the console window and perform the following steps:
Create a new folder. Note that the folder name defines the project name.
Change the working directory to the newly created folder.
Execute the following command to create a new project.
- Use the dotnet new winforms command to create a WinForms project.
- Use the dotnet new wpf command to create a WPF project.
Create a solution file.
Add the created .NET Core 3 project to this solution.
cmd> mkdir NewCoreApp cd NewCoreApp dotnet new winforms dotnet new sln dotnet sln add NewCoreApp.csproj
Open the solution file in Visual Studio.
Enable the Use previews of the .NET Core SDK option if you use .NET Core Preview version.
You can also use Visual Studio’s template to create a new .NET Core project.
Migrate Reporting Projects to .NET Core 3
The following resources provide information on when and how to migrate DevExpress desktop applications from .NET to .NET Core 3:
Details from Microsoft: Announcing .NET Core 3.0
Information on DevExpress WinForms apps: .NET Core Support
Information on DevExpress WPF apps: .NET Core Support
Install Reporting Package
Right-click the Dependencies node in the Solution Explorer and select Manage NuGet Packages in the invoked context menu.
Select DevExpress 19.1 Local in the Package source drop-down list and go to the Browse page. Find the DevExpress.WindowsDesktop.Win.Reporting/DevExpress.WindowsDesktop.Wpf.Reporting package and install it.
The installed libraries are added to the project after the installation is completed.
Add an Auxiliary Desktop .NET Project
The .NET Core 3 project’s infrastructure does not currently support design-time report creation. Add an auxiliary .NET Framework project to the solution and use the Report Designer to create new reports or edit existing reports.
In Visual Studio, add the Windows Forms App / WPF App (.NET Framework) or Class Library ( .Net Framework) project to your solution.
Create New or Edit Migrated Reports
Create New Reports
Right-click the auxiliary .NET project and choose Add | New Item… in the context menu.
In the invoked Add New Item dialog, switch to the Reporting directory, select the DevExpress v19.1 Report item, specify the report name, and click Add.
This invokes the Report Wizard. Choose Blank and click Finish.
Cut the added report from the auxiliary project and paste it in the .NET Core 3 project.
Add the report from the .NET Core 3 project to the auxiliary project as a link.
In the auxiliary project, double-click the report link’s .cs file to invoke the Report Designer where you can edit the report. Refer to the Get Started tutorials for information on how to create reports in the Report Designer.
Edit Migrated Reports
Use the auxiliary .NET project to edit the existing reports in the Report Designer.
Add the Reporting libraries to the project, for example, add an empty report to the .NET project, and then remove the empty report.
Add the reports from you .NET Core 3 project to the auxiliary .NET project as links.
In the auxiliary project, double-click the report link’s .cs file. This invokes the Report Designer where you can edit the report.
The following limitations apply when you design reports in an auxiliary .NET project for a .NET Core 3 project:
Do not use scripts.
Scripts are available in the Report Designer but raise an error when you run .NET Core 3 applications.
Synchronize connections between projects.
All new connections are saved to the auxiliary .NET project’s configuration file. Move this file to the .NET Core 3 project and use a link to it in the auxiliary .NET project.
Do not use the Object/EF/XPO Data Sources.
Objects from .Net Core 3 projects can not be used in the auxiliary .NET project at design time.