ReportingT Report ServerT Dark_870x220

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. 

Built up to the Standards 

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.

dotnet-frameworks-diagram

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.

What’s Included? 

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: 

  • All rendering extensions except MHTML and XPS are supported on Windows.
  • HTML, PDF and OpenXML-based renderings are supported on Linux/macOS.
  • All report items except the obsolete Chart item are supported.
  • The supported report definition types are TRDX, TRDP and report classes, created in Visual studio without the VS designer-specific code.
  • New JSON-based reporting configuration is introduced for both CLI and web applications. For CLI projects the JSON configuration has precedence over the current XML-based reporting configuration. Check here for more details.

What’s not Included?

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.

How do I Run it on Linux?

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:

sudo apt-get update
sudo apt-get install libc6-dev
sudo apt-get install libgdiplus
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.  

And How do I Run it on macOS? 

The same way you did on Linux - the difference is only the script that installs the libgdiplus library:
brew install mono-libgdiplus

Wow. What about Containers? 

No problem, as long as the container image meets the GDI+ requirements. The microsoft/windowsservercore images distributed by Microsoft contain the graphics library, but their size is significantly bigger compared to the size of the dotnet runtime in a Linux container. Such container only needs the libgdiplus and its accompanying libraries installed, which can be done through the following dockerfile snippet:
FROM microsoft/dotnet:2.1-runtime AS base 
RUN apt-get update \ 
    && apt-get install -y --allow-unauthenticated \ 
        libc6-dev \ 
        libgdiplus \ 
        libx11-dev \ 
    && rm -rf /var/lib/apt/lists/*

Having these three libraries installed ensures that Telerik Reporting will run on the produced Docker image.

Amazing, but how do I Start? 

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 WindowsLinux, and macOS. The project can be found in the %programfiles(x86)%\Progress\Telerik Reporting R1 2019\Examples\CSharp\Asp.NetCoreDemo directory.

Conclusion 

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.

Try it Out and Share Your Feedback

If you are new to our tools or have only tried some, make sure you download the trial and take them for a spin. You can either download just the Reporting and Report Server tools, or download a trial of our entire set of .NET and JavaScript tools with the DevCraft bundle.

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
About the Author

Ivan Hristov

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.

Related Posts

Comments

Comments are disabled in preview mode.