Reusing .NET Framework 4+ ReportLibrary Reports in .NET
Environment
Product Version | 13.0.19.116+ |
Product | Progress® Telerik® Reporting |
Description
The class library that contains report definitions must target .NET Framework 4.0 or greater in order to provide design-time support in Visual Studio through the Visual Studio Report Designer. Such library cannot be referenced in a .NET Core project because .NET Core projects can reference only .NET Standard or .NET Core assemblies (see the post How to reference a .NET Core library in WinForms - Or, .NET Standard Explained for detailed explanation).
Therefore the existing type report definitions must be migrated to a .NET Standard or .NET Core class library. The drawback is that there is no design-time support for .NET Core or .NET Standard and the Visual Studio Report Designer cannot be used in such projects. This is mainly because of the current limitations of the framework and Visual Studio toolset (for example, ComponentDesigner class which is used as a base class for our components, is not yet supported by .NET Core framework).
Solution
There are two approaches to resolve the problem depending on the amount of custom code used in the report definitions.
-
If the report classes do not contain custom code (i.e. handlers for events like NeedDataSource, ItemDataBound, etc.) or this code can be substituted with conditional formatting and bindings in the report definition, it is recommended to use the Standalone Report Designer to import them into a set of
.TRDP
/.TRDX
reports, as explained in the article on importing reports created with the VS Report Designer.If the report uses class library assemblies that contain user functions or provide data for ObjectDataSource instances, you may use the .NET version of the Standalone Designer. For the .NET Framework version of the designer, their projects need to be migrated to .NET Standard so that it may be able to load the assemblies and provide design-time support for them.
The produced
.TRDP
/.TRDX
definitions can be used through a UriReportSource in a .NET Core application. -
If the custom code in the report definitions must be retained, reference the
.cs
and.resx
files of your reports to a new .NET Standard or .NET Core library. The.designer.cs
file will be added automatically with the.cs
file. Add references to NuGet packages for the missing classes (i.e.System.Drawing.Common
for thePaperKind
class). Once the project compiles, the report classes it contains can be used through a TypeReportSource or InstanceReportSource in a .NET Core application.If you need to be able to edit your existing CLR reports, follow the KB article How to use Visual Studio Report Designer to edit CS Reports in .Net Core Projects.
It is recommended to use the first approach and migrate the reports to .TRDP
or .TRDX
report definitions, so the design-time support will be provided by the Standalone Report Designer.