Hello,
I have a solution that contains multiple .net core 2.1 projects.
My main goal is to generate reports from within the same solution so I either need to reference a .net core 2.1 datamodel project that has all my data contexts. The problem right now is that because all the telerik reporting services and library projects are all still running .net 4.6.1 framework when I try to reference my datamodel project I'd get a bunch of reference errors.
Would someone point me in the right direction to get this working?
Thanks
27 Answers, 1 is accepted
In our R1 2019 release which was published yesterday, we introduced a .NET Core support for projects that do not require targeting the full .NET Framework. Now you will be able to render reports from pure .NET Core applications. Please note that the design-time experience is not supported, so you will not be able to use the Visual Studio designer to create reports in a .NET Core class library. We recommend to use the Standalone Report Designer to design the reports or create them programmatically. Please check the related documentation article here: .NET Core support for more details.
Our product now ships with an ASP.NET Core example designed to help you to get started using Telerik Reporting in a .NET Core environment. Please check the last release and feel free to share your feedback.
Regards,
Ivan Hristov
Progress Telerik

Hi Ivan,
I see, is there any way for the Standalone Report Designer to use external assemblies based off of .net core library? I got the report to render in a .net core environment but only for reports that uses a sql datasource. In my case I need to use a object datasource that needs to take in methods from a .net core 2.1 library. Right now the Standalone Report Designer can only find assembly references for full .net 4.6.1 libraries.
The reason for this is I have a .net core library project called DataModels and the way I wish to have this done is by having another .net core library project called ReportingLib or something along these lines that will have a provider class that uses the DataModel project to grab data from my database using Linq. These data inside my provider class will be used to generate the report (this is the part where I'm kind of stuck as the Standalone Report Designer only finds the full .NET framework libraries and not my .NET Core ones.)
If I create a full .NET framework library, I won't be able to reference my DataModel project as I'll get reference errors due to the 2 framework mismatch.
Are there any way around this?
Thanks

I am in need of this same functionality as well.
Thanks,
Scott
Standalone Report Designer is a WPF application built using .NET Framework 4. By design it is impossible to add a .NET Core assembly reference to a .NET Framework project. The projects that target the full .NET Framework (4.6.1+) can reference .NET Standard assemblies but not .NET Core ones. This excellent post explains how to choose a target platform and how to reference it: How to reference a .NET Core library in WinForms - Or, .NET Standard Explained.
If your scenario allows it, please change the target framework of the business classes library to .NET Standard and these classes should appear in Standalone Report Designer. Please note that if the class library has some dependencies to other assemblies, they should be added in the Standalone Report Designer folder and listed in <probing> configuration element, as explained here: Extending Report Designer.
Hope this helps.
Regards,
Ivan Hristov
Progress Telerik

Thank for the reply, Ivan. In my case I can recompile my assemblies to .NET Standard so that works for me.
Regards,
Scott

Hi Ivan,
Thanks for the help. For the time being I'll probably hold up on porting my libraries over to .net core as this may complicate things in the future for what I want it to do.
I've taken a look at .net core examples that came with R1 2019 and the targetted framework for that project is targetting .net 4.6.1. Is there any plans in the future to have Reporting that will work completely with .net core framework?
And are we able to create a .net core api project that will allow me to make calls to your rest api without having it again to target 4.6.1. I'm just trying to have my projects be consistent with the rest and have it targetting the same framework if possible. (Seems like all the nuget packages that are required for the rest services to work all only work on 4.6.1 though).
Thanks
The Telerik Reporting R1 2019 installer should have installed a project called Asp.NetCoreDemo in the \Examples\CSharp subfolder of the installation directory. This project targets .NET Core 2.1 and is a working example of using the Reporting REST API in a ASP.NET Core web application. It uses the new SDK-style project and utilizes appsettings.json as a configuration file. The assembly references are resolved through NuGet packages. The project can be used in Windows and Linux environments because it employs Kestrel as a web server.
Please refer to the attached screenshot that shows the loaded project and its Properties page and make sure you're not using the Asp.NetCoreFullDemo project, which shows how to use Telerik Reporting in a ASP.NET Core project that targets the full .NET Framework.
Hope this helps.
Regards,
Ivan Hristov
Progress Telerik

Ivan,
I have tried creating a test .Net Standard Library - I've tried 2.0, 1.6, and 1.5 - and I cannot get them to show up in the standalone Report Designer after copying them to the folder. I have full .NET Framework dll's that work fine. I'm not referencing any other assemblies, actually, I'll just include the code below. Any help appreciated - Scott
using System.Collections.Generic;
namespace ReportingLibrary
{
public class Data
{
public static List<Customer> RetrieveData()
{
var data = new List<Customer>();
Customer c = new Customer(0, "Bilbo", "Baggins", 150.00);
data.Add(c);
return data;
}
}
public class Customer
{
public Customer(int id, string firstname, string lastname, double balance)
{
ID = id;
Firstname = firstname;
Lastname = lastname;
Balance = balance;
}
public int ID { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public double Balance { get; set; }
}
}


Hi Scott
I've done what you were trying to do before. To get the report designer to find user defined functions you'd need to put the dll generated on build into the Report Designer folder in your Telerik/Progress folder Location could vary but for example: C:\Program Files (x86)\Progress\Telerik Reporting R1 2019\Report Designer. You'd then have to edit the Telerik.ReportDesigner.exe to include the assembly reference: example on how it's done and modify the app.config file of your library example here

Ignore that last post please. It's working just fine with a .NET Standard 2.0 Library. I had an issue with my naming in the .config file.
Regards,
Scott

Ivan,
Ignore my last post please - it's working perfectly with a .NET Standard 2.0 DLL. I had a naming issue in the .config file of the Report Designer.
Regards,
Scott

I'm glad the things on your side finally work well and thanks for sharing the problems and the solutions you came up with.
If you need further assistance please do not hesitate to ask.
Regards,
Ivan Hristov
Progress Telerik

Hi Ivan
I've been searching around for a resolution to my issue of trying to get an ASP.NET Core application to be able to use Telerik Reporting for previewing reports. I have previously used Telerik Reporting in ASP.NET MVC and am familiar with it as a product. I have a report layout that I've generated using the standalone report designer. This report gets it's data from a SQL database via a stored procedure. I've followed all the documentation and examples I can to try to get reporting working but to no avail. I have incorporated the required changes to Startup, implemented a ReportsController and setup a Reports.cshtml file and when I call the Reports action of my Reports Controller I get a page with an error as follows:
{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at Telerik.Reporting.Services.Engine.ResourcesEngine.GetResource(String folder, String name)\r\n at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetResource(String folder, String resourceName)\r\n at lambda_method(Closure , Object , Object[] )\r\n at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)\r\n at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()"}
Clearly I've got something not setup correctly. I've noted the comments about using appsettings.json to configure Telerik Reporting but in the demo example the only setting used is a connection string and none of the other documented settings seem to be used. I just don't get what I'm missing. Can you provide some suggestions of what I need? In MVC I passed a "ReportSupportModel" object to the report viewer as the model. It contained the report name and parameters required for the report (usually an item id and in some cases a run date too) and I had code in the report to create a UriReportSource which is then used by the review. Can you give me some pointers. I'm currently using R1 2019 in VS 2017.
Thanks in advance

Further to my earlier post, I've just updated to R2 2019 for the entire solution and I no longer get an error, instead I get a completely blank page. I've adjusted the ConfigurationService in line with the latest example. Any thoughts on what I'm missing? Is it as simple as my view being in the wrong location in the project or something like that? How should I tell the viewer which report to load and what it's parameters are? This project will ultimately have multiple reports in it that users will be able to select as an action link from a Telerik Grid to run a report for a chosen item as one example.
Thanks.
Based on the stack trace, it seems the NullReference exception is thrown by the REST service while it tries to resolve a resource to be served to the client. In R2 2019 the only necessary script that needs to be referenced on the client is the TelerikReportViewer's JavaScript file, which looks like this in the index.html file:
<
script
src
=
"/api/reports/resources/js/telerikReportViewer"
></
script
>
<
script
src
=
"@Url.Content("
~/api/reports/resources/js/telerikReportViewer")"></
script
>
The report viewer template file and the JavaScript file with the KendoUI widgets will be served by the REST report service to the client.
Unfortunately I'll need more information about the issue in order to provide more detailed answer. Please check the project CSharp.AspNetCoreDemo that ships with our installation and see how it references the JavaScript files to initialize the report viewer. In case you need further assistance, please send us a runnable sample of your project so we can investigate it on our side.
Regards,
Ivan Hristov
Progress Telerik

Unfortunately I'm still getting nowhere on this. Firstly, this is an ASP.NET core project so why do I need to use an index.html file for this rather than a Razor view as per the previous MVC reporting I did with my last project - I understood from your R1 2019 documentation that you now fully supported ASP.NET Core. There's just too many "unexplained" goings on here. I've been through the documentation in detail and it all seems to be smoke and mirrors to me. The simple fact is I have a ReportsController based entirely on your sample code, I have included the relevant Nuget packages in the project and as I stated before I have setup the ConfigurationService in line with your R2 2019 example. What's not at all clear from the code samples is exactly where the ReportViewer is being called from and exactly where it's looking for the scripts.
In this application there will be various reports that will be accessed, in many cases from Kendo ASP.NET Core grids, using a custom button to pass the id of the selected row to a controller action which will then call the report preview, passing a model containing the name of the report file (.trdf) and the necessary id to be passed into a parameter. The reports will be bound to a SQL stored procedure and the parameter will allow for production of the required report based on the chosen data item. The problem I have is that I call the controller from the grid and get the id of the related item. From there I redirect to the report controller "Reports" action passing the relevant parameters to build the model. It then would (as it did in MVC) return the relevant Reports view but it seems from the various code snippets and use of an "index.html" that this is simply not possible and your examples are not close to providing sufficient guidance for me to work out how to implement this approach. I really need some specific pointers how to get this implemented in an ASP.NET core project in the way I've described.
Thanks in advance

I've made further progress and I seem to now finally have the report viewer loading. However, having hard coded the report name and a single parameter for it to get it to load the page loads with the usual "loading..." message and then becomes blank. If I review the page for errors I can see the attached error - "Failed to load resource: the server responded with a status of 400 () - .../api/reports/clients:1" and "Uncaught (in promise) Invalid clientID"
I've looked around but can't find any suggestion of what could be causing that. The report file I'm loading works correctly in the report designer so I know that is OK
Sorry to hear you're still experience issues with our product and I hope I'll be able to help you to fix them.
In my previous answer I sent you the lines that initialize the report viewer widget for both index.html and index.cshtml. Currently we do not have a version of Telerik.ReportViewer.Mvc.dll built against .NET Core, therefore in a MVC ASP.NET Core project you have to use the HTML5 viewer widget in a .html page rather than in a cshtml view. You can check the how-to article that explains in a step-by-step manner how to configure the viewer in such application: How to implement Telerik Reporting in ASP.NET Core 2.1 MVC.
Based on the last post and the attached screenshots, it seems that the request for creating a client is not processed by the REST service. HTTP Response code 400 means Bad Request and is returned when the request is malformed or invalid and cannot be processed by the server. The returned value cannot be interpreted as a valid Client ID, hence the Uncaught (in promise) exception is thrown.
Unfortunately from the provided information I cannot determine what is the reason for this behavior. In such cases we recommend to use a web proxy tool like Fiddler which can be used to inspect the requests and responses to and from the REST service. Please check the following articles that explain how to create a troubleshoot web applications and how to generate a Fiddler log:
Troubleshooting reporting implementation into ASP.NET Core application
HTML5 Viewer Troubleshooting
In case the information in articles above doesn't help, please send us your project so we can examine it on our side.
Regards,
Ivan Hristov
Progress Telerik

It seems I misinterpreted previous responses and the update in R1 & R2 2019 which at least from my brief read through suggested I could use the report viewer in a cshtml page loaded within our main layout view much as I did in a previous MVC5 app I used Telerik Reporting in. Clearly this isn't correct so I'll adapt what I have an hopefully it will then work. I'm still not clear on the methodology for calling the report viewer with the best way to pass the report file name and any parameters to it from a controller action so anything you can iron out there for me would help. Most of the reports within this particular application will be single page reports from a chosen object, either from a form or from a Kendo grid. At present, I'm trying to test a key report which is run from a button on an edit form. Currently it calls a controller action to open the report. I'd like to retain that approach if it will work but if there's another way I need to do it then let me know.
Thanks

We noticed that you opened a support ticket on the same topic, where you provide more details about what you have done so far and what are the current issues. I see that you've explained it also here, in this forum thread. For the benefit of our community I will post my response here as well:
"I collaborated with Ivan and reviewed the forum thread that you were trying to find a solution of the problem: https://www.telerik.com/forums/telerik-reporting-with-net-core.
As we are always trying to do our best to help our customers, based on the provided descriptive information, I created a sample runnable project that loads the viewer as expected. The setup is like:
- ASP.NET Core application using the MVC template for a project structure
- As it is a Core MVC project, I've followed the steps in our additional resource: How to implement Telerik Reporting in ASP.NET Core 2.1 MVC
- The project is build against .NET Core 2.2
- The used Telerik Reporting version is from our R2 2019 release (13.1.19.514)
- The report viewer jQuery widget is defined in ReportViewer.cshtml in Home folder (in order to keep the views consistent. I agree that you could use cshtml and I'm sorry for the misleading from my colleague)
- To display the newly added MVC page, I use Home controller to create an action returning the view
- Changed the serviceUrl option to point one directory up, i.e. serviceUrl: "../api/reports/" in order the service to run successfully
- In a separate reportingAppSettings.json configuration file is passed the ConnectionStrings
Please review the project and compare it to yours for any differences. I hope it will help you determine the exact cause.
In case the issue still persists, please modify this sample project to demonstrate the issue and send it back to us for further investigation."
Best Regards,
Silviya
Progress Telerik

The problem is now identified and it's nothing I expected and perhaps nothing you'd have expected either. The problem of not registering the viewer with the service is the following code:
this.services.AddMvc(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddJsonOptions(options =>
options.SerializerSettings.ContractResolver = new DefaultContractResolver());
Changing the code to this:
this.services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
.AddJsonOptions(options =>
options.SerializerSettings.ContractResolver = new DefaultContractResolver());
i.e. removing the AutoValidateAntiForgeryTokenAttribute then makes the report run. I'm excusing myself for not having spotted that one!
I'd be interested to have your thoughts on that.
Oh great that you've found the issue! Great job!
Now, up to the AntiforgeryToken attribute. I've faced this issue with another customer and I was able to find a solution for it. Please check my response in this thread for more information: ASP .NET Core 2 issue with Reporting R1 2019 and antiforgery token.
I hope this will help.
Best Regards,
Silviya
Progress Telerik

I accidentally replied on the other post.
Given that it's currently working and we're behind schedule we'll leave it as it is and perhaps look at this at a later stage to see if we can get it working.
Sure, let us know how it goes.
Best Regards,
Silviya
Progress Telerik