In R1 2019 we introduced support in Telerik Reporting for .NET Core applications running on Windows, Linux and macOS. Give it a try and leave your feedback!
In the last couple of years .NET Core has grown from a modularized fork of .NET Framework to a fully functional platform that allows you to build and run the same applications on Windows, Linux, and macOS. With each release .NET Core delivers new APIs and adds many optimizations, ultimately positioning itself as a framework-of-choice for more and more .NET Developers. So it's not surprising that the most demanded feature in the Feedback Portal for Telerik Reporting was to provide support for .NET Core applications.
Being naturally curious, we on the Reporting team have long been keeping an eye on the .NET Core evolution, and we recently decided that the framework was mature enough to fit most of our needs. And, lo and behold, in R1 2019 we introduced .NET Core support for the Telerik Reporting runtime.
Telerik Reporting assemblies can be referenced via NuGet packages from our Telerik NuGet private feed or through assembly references to local .dll files. If you check the installation directory of our product you will notice that the last release brought a new addition – a netstandard2.0 subfolder. It contains the assemblies you would reference when building a .NET Core application, but the assemblies themselves target .NET Standard 2.0. .NET Standard is a set of fundamental APIs that are available in all .NET implementations. Designed as a formal specification, it determines a base set of functionalities for the .NET ecosystem.
Essentially, the main advantage of targeting .NET Standard is that our assemblies will work in all .NET applications on all supported operating systems.
image obtained from blogs.msdn.microsoft.com
A nice feature of the unification of cross-platform development is that the .NET Standard assemblies can be referenced even in your current .NET Framework application. But why would I? – you may ask. Well, it is not mandatory, since we already provide Telerik Reporting assemblies targeting the full .NET Framework. But this approach may have at least two major advantages: it delivers the optimization benefits in .NET Standard and helps to ease the eventual migration process of your application to .NET Core.
All the major Telerik Reporting functionalities work in .NET Core command-line and web applications. On Windows, the reporting engine still relies on the GDI+ library because it provides the fastest and most convenient way to process text and images, which is essential to the product. In Windows environments .NET Core runtime manages to resolve the GDI+ calls natively, but for Linux and macOS, one or more additional libraries need to be installed, depending on your distribution (explained in details later in this article). Almost all the processing and rendering features that work in a .NET Framework application will work in .NET Core projects with the new .NET Standard assemblies.Here is a more detailed list of supported functionalities:
To design reports for a .NET Core project we recommend using the Standalone Report Designer. Its report definitions are stored in a portable .trdx/.trdp format and can be utilized with UriReportSource where needed.
The Visual Studio Report Designer is available only for class libraries that target the full .NET framework. We cannot provide design-time support for reports in .NET Core or .NET Standard libraries, because we are limited by the current state of the framework and the Visual Studio toolset. For example, the ComponentDesigner class, which is used as a base class for our components, is not yet available in .NET Core. As for migrating the existing report libraries, this KB article will help you pick the right strategy.
When deploying to a Linux machine, make sure it has installed the libgdiplus library, which is a Mono implementation of GDI+ API for non-Windows operating systems. The following snippet performs an update and installs the necessary libraries on Ubuntu/Debian:
Since libgdiplus is not an exact replacement for the Windows graphics library, the rendered reports might not have the same text positioning, word-wrapping and aligning, compared to rendered reports on Windows. We did a lot of improvements to the text and graphics rendering engine, but slight differences are to be expected.
sudo apt-get update
sudo apt-get install libc6-dev
sudo apt-get install libgdiplus
brew install mono-libgdiplus
FROM microsoft/dotnet:2.1-runtime AS base
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
&& rm -rf /var/lib/apt/lists/*
Having these three libraries installed ensures that Telerik Reporting will run on the produced Docker image.
Telerik Reporting ships with a ready-made ASP.NET Core example that demonstrates how to show our sample reports in an ASP.NET Core application. The example also shows how to inject an appsettings.json configuration file to the controller and how to initialize a WebHostBuilder so it runs under Windows, Linux, and macOS. The project can be found in the
%programfiles(x86)%\Progress\Telerik Reporting R1 2019\Examples\CSharp\Asp.NetCoreDemo directory.
Building Telerik Reporting for .NET Core was a huge feat for our team. It will allow us to reach to a broader audience of developers that want to build modern cross-platform applications. Adding support for the most rapidly evolving development platform is another step towards delivering a top-quality product to our users.
We're eager to hear what you think, so please don't forget to share your feedback as well and help us make Telerik Reporting even better.
Ivan Hristov has been a software developer in the Telerik Reporting division since 2013.
When not at work, he might be seen biking/skiing with his daughter, reading or discussing influential movies with friends. Feel free to reach out to him through LinkedIn.
Subscribe to be the first to get our expert-written articles and tutorials for developers!