How to use Visual Studio Report Designer to edit CS Reports in .Net Core Projects
|Product||Progress® Telerik® Reporting|
|.Net Framework||.NET Core 3.0+|
Currently, the .NET Core frameworks do not support the design time components we need for the Visual Studio Report Designer. Without these components we cannot provide a quality design-time experience.
This KB article describes a workaround for using the Visual Studio Report Designer to edit C Sharp reports hosted in a .NET Core/5/6 ClassLibrary project.
The CSharp code of a report definition is identical in .NET Framework and in .NET Core. For that reason, it is possible to link the report definition files hosted in a .NET Core ClassLibrary project to the corresponding files hosted in a .NET Framework ReportLibrary project. This way, all the changes made with the Visual Studio Report Designer to the report in the .NET Framework project will be automatically applied to the .NET Core project.
Lets assume that we already have a ReportLibrary project in .NET Framework. Here are the necessary steps to link it to a .NET Core ClassLibrary project:
Create a new .NET Core 3.1/5/6 ClassLibrary project. You may delete the default CS file usually named Class1.cs.
Add references to the following assemblies/NuGet packages in the project:
- Telerik.Reporting - defines the needed report definition elements
- System.Resources.Extensions - needed to resolve the resources from the RESX file
Add the corresponding CS report file from the .NET Framework project to the .NET Core project through the Add -> Existing Item... option of the project context menu.
When selecting the CS file make sure to select Add As Link from the Add Existing Item wizard. The corresponding DESIGNER.CS file will be added automatically.
Add in the same way also the RESX file of the report definition.
Reference the .NET Core ClassLibrary project in your .NET Core project hosting the Telerik Reporting engine. Pass the AssemblyQualifiedName of the report class to the Reporting engine. Use TypeReportSourceResolver for resolving your reports in a Telerik Reporting REST Service.
A demo solution demonstrating the approach may be found in our GitHub repo - VS Designer in .NET Core