Reporting in .NET Core 3.x and .NET 5
- 5 minutes to read
ASP.Net Core 3.x Reports maintain feature parity with previous .NET Core versions and .NET 5. Upgrading ASP.NET Core 3.x Reporting projects to .NET 5 is straightforward. The projects use the same Report Designer engine. A Visual Studio extension associated with VSREPX (XML report definition) files launches the DevExpress Report Designer and saves all edits to XML. When the Visual Studio Report Designer creates a new report, it stores it in a work file with the .VSREPX extension, included in the project. To transfer a report to another project, use the Save command to save the report to REPX format.
Refer to the following help section for more information: ASP.NET Core Reporting.
WinForms and WPF (Visual Studio Report Designer)
Due to limitations in .Net Core 3.x and .NET 5, we have been unable to integrate the DevExpress Report Designer into Visual Studio’s IDE (for WinForms or WPF projects). To work around this limitation and create reports at design time, create an auxiliary .NET Framework project to store reports and link these reports in your .Net Core 3.x (or .NET 5) project. We are in contact with Microsoft and are hopeful that the Visual Studio team will address Visual Studio’s limitations in future builds.
This document describes the work-around technique in detail.
Your application can also generate reports in code (without the use of our Report Designer). Review the following topic for more information: Create Reports in Code.
Visual Studio 2019 - the latest version with the .NET desktop development workload
The techniques described in this document apply to both WinForms and WPF applications.
Create a New or Migrate Existing Project
Create a New .NET 5 Project
Open the console window and execute the following commands to create a new project:
mkdir WinFormsApp1 cd WinFormsApp1 dotnet new winforms dotnet new sln dotnet sln add WinFormsApp1.csproj
dotnet new wpf command to create a WPF project.
Open the solution file in Visual Studio.
Enable the Use previews of the .NET Core SDK option if you use .NET Core Preview version. For this, select Tools | Options in the main menu to invoke the Options dialog:
You can also use Visual Studio’s template to create a new .NET Core project.
Migrate Applications to .NET Core 3.x or .NET 5
The following resources provide information on when and how to migrate DevExpress desktop applications from .NET to .NET Core 3.x or .NET 5:
Details from Microsoft:
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 20.2 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.x and .NET 5 projects do not 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 or Edit Reports
Create New Report
Right-click the auxiliary .NET project and choose Add | New Item… in the context menu.
In the invoked Add New Item dialog, click the Reporting node, select the DevExpress v20.2 Report item, specify the report name, and click Add.
This invokes the Report Wizard. Choose Blank and click Finish.
Add the report from the auxiliary project to the .NET 5 (or .NET Core 3.x) project as a link.
In the auxiliary project, double-click the report’s .cs file to invoke the Report Designer where you can edit the report.
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 your auxiliary .NET project to the .NET Core 3.x project as links.
In the auxiliary project, double-click the report’s .cs file. This invokes the Report Designer where you can edit the report.
View and Edit Reports at Runtime (WinForms and WPF)
In the .NET 5 (or .NET Core 3.x) project, you can use the following code to invoke the End User Report Designer at runtime:
using DevExpress.XtraReports.UI; // ... ReportDesignTool designTool = new ReportDesignTool(new WinFormsAuxiliaryProject.XtraReport1()); designTool.ShowRibbonDesigner();
Use the following code to invoke the Document Viewer at runtime:
using DevExpress.XtraReports.UI; // ... ReportPrintTool printTool = new ReportPrintTool(new WinFormsAuxiliaryProject.XtraReport1()); printTool.ShowPreview();
Data Source Specifics
Consider the following requirements when you design reports in an auxiliary .NET project for a .NET 5 (or .NET Core 3.x) project:
Manual data connections synchronization between projects.
When you design a report, newly created data connections are saved to the auxiliary .NET project’s configuration file. Move the configuration file to the .NET 5 (or .NET Core 3.x) project and add a link to that file in the auxiliary .NET project.
Do not use the Object/EF/XPO Data Sources.
Objects from the .NET 5 (or .NET Core 3.x) project cannot be used in the auxiliary .NET project at design time.