Current filter:
                                You should refresh the page.
                                  • Description:
                                    *Q: Is it possible to use DevExpress Reporting components in ASP.NET Core application?
                                    A:  Yes, starting with version 18.1, you can use our Reporting controls in ASP.NET Core applications. Please refer to the ASP.NET Core Reporting help topic for more information.

                                    *Q: And what about cross-platform (Linux / macOS)  *ASP.NET Core applications? Is it possible to use DevExpress Reporting components in such applications?
                                    A:  Our server-side Reporting engine uses theGDI+ (System.Drawing) library's functionality to draw a report's content and export it to certain formats. However, this library's implementations are different on different OSs, so the output produced by our components may differ on these OSs.

                                    Answer:
                                    Starting with version 17.2 you can use our Reporting controls in ASP.NET Core applications targeting .NET Framework by using built-in extensions. Please refer to the ASP.NET Core Reporting  help topic to learn how to use these extensions.
                                    You can also download a sample project that demonstrates this approach in action here: T577088: How to use Reporting Controls in ASP.NET Core applications.

                                    Note that in the  *17.2 version these extensions are available as a Community Technology Preview.

                                    The approach provided below is obsolete starting with version 17.2. Use the approach provided in the solution above for versions 17.2+.
                                    Note that the code provided below is actual for version 17.1 only. In any case, you can find sample projects with the code for earlier versions of our suite attached.

                                    To integrate our ASP.NET Reporting components into an ASP.NET Core Web Application (.NET Framework)  application, you should accomplish the following steps:

                                    1. Reference all assemblies required for our ASP.NET Reporting components in your application;
                                    2. Register all client-side libraries and style sheets that are required for our ASP.NET Reporting components on your web page;
                                    3. Register our Reporting controls' client-side code, style sheets, and HTML templates (Knockout) and put HTML elements that will be used to display these controls to your Views;
                                    4. Manually generate the control's client-side JSON model in your server-side controller's code and pass it to the client to initialize the control on the client side;
                                    5. Register server-side services required for our Reporting controls on the application startup.
                                    6. Register controllers that will process requests coming from our Reporting controls.

                                    The attached sample solution demonstrates these steps for both Web Report Designer and Web Document Viewer. This sample solution consists of two projects:
                                    - DevExpressASPNETCoreReporting – A project created by using an ASP.NET Core Web Application (.NET Framework)   template in Visual Studio, which represents a typical ASP.NET Core web application;
                                    - ReportsLibrary – A project that is used to provide all our Reporting assemblies to the ASP.NET Core project and contains of custom report classes definitions.

                                    Below you can find detailed instructions on how to perform the aforementioned steps:

                                    1. Referencing all assemblies required for our ASP.NET Reporting components.
                                    Please refer to the Assemblies Deployed with ASP.NET MVC Reporting Applications help topic to learn what assemblies are required for our ASP.NET Reporting components in ASP.NET MVC applications. For the ASP.NET Core project, you will need all the assemblies listed in that help topic excluding  those that start with the DevExpress.Web prefix. The
                                    simplest way to add all these references to your ASP.NET Core application is to reference a Class Library project, which references all assemblies required for DevExpress reporting. That's why, the "ReportsLibrary" project was added to the solution. This project loads all ASP.NET Reporting assemblies from your developer machine's GAC.

                                    2. Registering all client-side libraries and style sheets that are required for our ASP.NET Reporting components on the web page.
                                    The following script libraries are required for our ASP.NET Reporting components starting with version 16.2:

                                    Third-Party Libraries:
                                    jQuery 1.11.3+
                                    jQuery UI 1.11.4+ (should include core, widget, mouse, draggable, resizable, **selectable**modules, both JavaScript and CSS files)
                                    globalize v1.1.1+ (should include message, number, date, **currency**modules, and cldr, cldr.event, cldr.supplemental scripts)
                                    knockout 3.3.0+
                                    - ace.js 1.1.9 (required for the Web Report Designer only; should include the ext-language_tools script)
                                    DevExtreme Libraries:
                                    - dx.all.js (should include the dx.common.css stylesheet along with the theme stylesheet: dx.light.css or dx.dark.css)

                                    Please refer to the Manual integration part of the Why doesn't the HTML5/JS based component work and client-side errors are thrown article to learn how to register client-side libraries required for our ASP.NET Reporting components on your web page.
                                    Note that all these libraries will be automatically uploaded to your project by installing the "xtrareportsjsBower package. See the next step for more details on how to do this.

                                    3. Registering client-side code, style sheets, and HTML templates (Knockout) used by our Reporting components and putting HTML elements that will be used to display these controls to the application's Views.
                                    You can get all client-side code, style sheets, and HTML templates that are used by our Reporting components from our GitHub repository: DevExpress/bower-xtrareports-js. Use Bower Package Manager to install these files to your application. There are several ways to do this:
                                    - Use the "Manage Bower Packages" window in your Visual Studio as described in the Manage client-side packages with Bower in ASP.NET Core MSDN help topic;
                                    - Add the "xtrareportsjs" package to the dependencies list in your project's bower.json file;
                                    - Run the following command in your console: bower install xtrareportsjs

                                    For the HTML5 Document Viewer component, register the flowing files on your web page:

                                    [HTML]
                                    <script src="~/lib/xtrareportsjs/js/dx-designer.js"></script> <link rel="stylesheet" href="~/lib/xtrareportsjs/css/web-document-viewer-light.min.css" /> <script type="text/html" src="~/lib/xtrareportsjs/html/web-document-viewer.html"> </script> <script src="~/lib/xtrareportsjs/js/web-document-viewer.js"></script> <script src="~/lib/xtrareportsjs/js/localization/web-document-viewer.en.js"></script>

                                    And then, put an HTML element to the place where your would like to display the HTML5 Document Viewer component on your web page:

                                    [HTML]
                                    <style> #reportViewerContainer { width: 100%; height: 800px; } </style> <div id="reportViewerContainer" data-bind="dxReportViewer: $data"></div>

                                    For the Web Report Designer component, register the flowing files on your web page:

                                    [HTML]
                                    <script src="~/lib/xtrareportsjs/js/dx-designer.js"></script> <link rel="stylesheet" href="~/lib/xtrareportsjs/css/report-designer-light.min.css" /> <script type="text/html" src="~/lib/xtrareportsjs/html/report-designer.html"></script> <script src="~/lib/xtrareportsjs/js/report-designer.min.js"></script> <script src="~/lib/xtrareportsjs/js/localization/report-designer.en.js"></script>

                                    And then, put an HTML element to the place where your would like to display the Web Report Designer component on your web page:

                                    [HTML]
                                    <style> #reportDesignerContainer { height: 800px; width: 100%; } </style> <div id="reportDesignerContainer" data-bind="dxReportDesigner: { designerModel: designerModelToBind, initializationData: observableJsonModel }"></div>

                                    4. Initializing the control's client-side JSON model in the server-side controller's code and passing it to the client to initialize the control on the client side.
                                    To generate the HTML5 Document Viewer control's JSON model, use the following code:

                                    [C#]
                                    public IActionResult ReportViewer() { var clientSideModelGenerator = new WebDocumentViewerClientSideModelGenerator(); var clientSideModelSettings = new ClientSideModelSettings { IncludeLocalization = false }; var modelString = clientSideModelGenerator.GetJsonModelScript(null/*you can pass XtraReport instance here*/, "/DXXRDV", clientSideModelSettings); var model = new ClientControlModel { ModelJson = modelString }; return View(model); }

                                    Insert the following code into your View's code before HTML5 Document Viewer's HTML element declaration, which will initialize the model passed from the web server on the client side:

                                    [JavaScript]
                                    <script type="text/javascript"> (function initialize() { var modelJson = @Html.Raw(Model.ModelJson); var viewerModel = ko.observable(null); var openReportSubscription = viewerModel.subscribe(function (newModel) { newModel && newModel.OpenReport('Categories') && openReportSubscription.dispose(); }); ko.applyBindings($.extend(modelJson, { viewerModel: viewerModel }), $("#reportViewerContainer")[0]); })() </script>

                                    To generate the Web Report Designer control's JSON model, use the following code:

                                    [C#]
                                    public IActionResult ReportDesigner() { var contentGenerator = new ReportDesignerClientSideModelGenerator(); var clientSideModelSettings = new ClientSideModelSettings { IncludeLocalization = false }; var globalDataSources = new Dictionary<string, object>(); globalDataSources.Add("nwindDS", new CategoriesReport().DataSource); var report = new XtraReport(); var modelString = contentGenerator.GetJsonModelScript(report, globalDataSources, "/DXXRD", "/DXXRDV", "/DXQB", clientSideModelSettings); var model = new ClientControlModel { ModelJson = modelString }; return View(model); }

                                    Insert the following code into your View's code before Web Report Designer's HTML element declaration, which will initialize the model passed from the web server on the client side:

                                    [JavaScript]
                                    <script type="text/javascript"> (function initialize() { var reportUrl = ""; //You can assign any URL supported by your ASPNETCoreReportResolver var modelJson = ko.observable(@Html.Raw(Model.ModelJson)); var designerModel = ko.observable(null); ko.applyBindings({ designerModelToBind: designerModel, observableJsonModel: modelJson }, $("#reportDesignerContainer")[0]); })() </script>

                                    5. Registering server-side services required for our Reporting controls on the application startup.
                                    Use the following code to register services that are required for our Reporting components in your ASP.NET Core application:

                                    [C#]
                                    public class Startup { ... AppBuilderServiceRegistrator serviceRegistrator; public void ConfigureServices(IServiceCollection services) { ... this.serviceRegistrator = new AppBuilderServiceRegistrator(services); WebDocumentViewerBootstrapper.RegisterStandardServices(serviceRegistrator); services.AddTransient<ISqlDataSourceConnectionParametersPatcher, BlankSqlDataSourceConnectionParametersPatcher>(); services.AddTransient<IWebDocumentViewerUriProvider, ASPNETCoreUriProvider>(); services.AddTransient<IWebDocumentViewerReportResolver, ASPNETCoreReportResolver>(); //Code required for Web Report Designer only QueryBuilderBootstrapper.RegisterStandardServices(serviceRegistrator); ReportDesignerBootstrapper.RegisterStandardServices(serviceRegistrator, () => serviceRegistrator.GetService<IReportManagementService>(), () => serviceRegistrator.GetService<IStoragesCleaner>(), () => serviceRegistrator.GetService<IConnectionProviderFactory>(), () => serviceRegistrator.GetService<IReportSqlDataSourceWizardService>(), () => serviceRegistrator.GetService<ISqlDataSourceConnectionParametersPatcher>() ); //Custom services for our Reporting components can be registered below ... } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { ... serviceRegistrator.UseGeneratedServices(app.ApplicationServices); DefaultWebDocumentViewerContainer.Current = DefaultQueryBuilderContainer.Current = DefaultReportDesignerContainer.Current = app.ApplicationServices; //Code required for Web Report Designer only ReportStorageWebExtension.RegisterExtensionGlobal(new CustomReportStorageWebExtension(env)); } }

                                    You can find source code of all these service classes in the "DevExpressOverrides" folder of the DevExpressASPNETCoreReporting project.

                                    6. Registering controllers that will process requests coming from the Reporting controls.
                                    First, add a base controller to your ASP.NET Core application, which will contain the common functionality used by all our Reporting  component and will be used as a base class for other controllers:

                                    [C#]
                                    public class RequestControllerBase : Controller { readonly IRequestManager requestManager; public RequestControllerBase(IRequestManager requestManager) { this.requestManager = requestManager; } protected virtual async Task<IActionResult> Invoke() { IEnumerable<KeyValuePair<string, StringValues>> query = null; if(HttpContext.Request.Method == "GET") query = HttpContext.Request.Query; else query = await HttpContext.Request.ReadFormAsync(); NameValueCollection nameValueCollection = new NameValueCollection(); foreach(var pair in query) { nameValueCollection[pair.Key] = pair.Value; } var result = requestManager.ProcessRequest(nameValueCollection); if(result is BinaryHttpActionResult) { var actionResult = (BinaryHttpActionResult)result; return File(actionResult.Bytes, actionResult.ContentType, actionResult.FileName); } else { return new ActionResultWrapper(result); } } }

                                    Then, register the controller that is required for HTML5 Document Viewer and Web Report Designer's Preview:

                                    [C#]
                                    public class ReportViewerController : RequestControllerBase { public ReportViewerController(IWebDocumentViewerRequestManager requestManager) : base(requestManager) { } [Route("DXXRDV")] public Task<IActionResult> ViewerInvoke() { return base.Invoke(); } }

                                    And the controllers below should be registered only if the Web Report Designer component is used in your application:

                                    [C#]
                                    public class QueryBuilderController : RequestControllerBase { public QueryBuilderController(IQueryBuilderRequestManager requestManager) : base(requestManager) { } [Route("DXQB")] public Task<IActionResult> QueryBuilderInvoke() { return base.Invoke(); } }
                                    [C#]
                                    public class ReportDesignerController : RequestControllerBase { public ReportDesignerController(IReportDesignerRequestManager requestManager) : base(requestManager) { } [Route("DXXRD")] public Task<IActionResult> ReportDesignerInvoke() { return base.Invoke(); } }
                                Show all comments
                                • NathanNoble 03.30.2017

                                  Hi DevExpress,

                                  Do you have an updated sample project for v16.1 ?

                                • Vasily (DevExpress Support) 03.30.2017

                                  Hi Nathan,

                                  I see that you created a separate ticket with this question: T498275: XtraReports WebDocumentViewer for ASP.NET Core RC1. So, we will post our reply in that thread.

                                • Andrezi 05.15.2017

                                  Hi,

                                  Could you share answer and code samples for ticket T498275: XtraReports WebDocumentViewer for ASP.NET Core RC1. ? The ticket is not publicly visible- error "You can't view this ticket".

                                  Regards

                                • Vasily (DevExpress Support) 05.15.2017

                                  Hi Andrzej,

                                  You can find this sample project updated to version 16.1 in the following thread: Devexpress MVC reports integration into Asp.Net 5, MVC 6 app. Let us know if you have any further questions regarding this approach.

                                • Mad Rian 05.23.2017

                                  Hello,

                                  I have downloaded the sample Project and wanted to run this with Version 17.1 but there seems to be a Problem:

                                  the namespace of ISqlDataSourceWizardService cannot be found in Startup.cs...

                                  please, can you Support us with a running sample for Version 17.1 (we are new to DevExpress Reports)

                                  [C#]
                                  Func<ISqlDataSourceWizardService> getSqlDataSourceWizardService;
                                • Vasily (DevExpress Support) 05.23.2017

                                  Hi Mad,

                                  I attached the MVC 6 application upgraded to version 17.1 to Eugeny's solution above. To run this sample project, perform the following steps:

                                  1. Build the "ReportsLibrary" project to get the NuGet package with all required DLL references. This NuGet package references an ASP.NET Core MVC application.
                                  2. Install this NuGet package from the ReportsLibrary" project folder or any other folder where the DevExpress.XtraReports.17.1.3.nupkg package is located.
                                  2. Restore Bower packages if it is necessary (to load the script libraries that are required for DevExpress HTML5 reporting components).
                                • Mad Rian 05.24.2017

                                  thx

                                • Vasily (DevExpress Support) 05.24.2017

                                  You are always welcome, Mad! Please do not hesitate to contact us if you have any further questions regarding this.

                                • fabio borghi 08.04.2017

                                  Hi Vasily,
                                  i've carefully readed all your post regarding report viewer and report designer into asp.net mvc core 1.0 app.
                                  I'm a bit confused, let me clarify the question: currently an the ASP.NET backend is required for because .NET Framework server backend is required for the report generation .
                                  I've explored 17.1 project you have enclosed to Eugeny's solution .
                                  I could see two projects all of them are currently using .NET Framework 4.5.2.
                                  What do you mean when you say asp.net core web app (without) .NET Framework should be decoupled from the backend asp.net core with .net support?
                                  Inspecting 17.1 project i could not find a clean asp.net core web app (without .net framework).
                                  Do you mean the DevExpressASPNETCoreReporting project will be the backend and a new missing asp.net core web app will be a front end?
                                  If this right, could you please complete 17.1 solution adding a clean asp.net mvc 1.0 project as front end?
                                  This new project will call DevExpressASPNETCoreReporting in order to process report
                                  Thank you
                                  Fabio

                                • Elliot (DevExpress Support) 08.04.2017

                                  Hello,

                                  I've created a separate ticket on your behalf (T542665: Provide a complete 17.1 solution adding a clean asp.net mvc 1.0 project as front end). It has been placed in our processing queue and will be answered shortly.

                                • Tyler O 08.25.2017

                                  I am following this guide to include a Report Viewer in my ASP.NET Core application, but when I include the viewer on a page I get these errors:

                                  [HTML]
                                  SCRIPT5009: 'ko' is undefined dx-designer.js (4516,13) SCRIPT5007: Unable to get property 'editorTemplates' of undefined or null reference web-document-viewer.js (11,208) SCRIPT5009: 'ko' is undefined 2fc054d0-c713-41d8-8e0a-f9658cd23ff4 (124,9) (This one is where ko.observable(null) is called on my View)

                                  I have the xtrareportsjs 17.1.3 Bower packaged referenced in my project, which includes knockout 3.4.2 as a dependency.

                                • Yaroslav (DevExpress Support) 08.28.2017

                                  Hi Tyler,
                                  There is nothing much I can say without looking at the actual source code. It is true that Knockout is one of the dependencies of our Bower package, but would you please confirm if it's included into your web page? (the original example does that in the _Layout.cshtml View). If you're sure about that, I'd appreciate it if you can share the modified version of this sample so I can take a look at it and check what's going on. This will greatly help us to track down the culprit of this issue and provide you with a solution ASAP.

                                  Regards,
                                  Yaroslav

                                • Edwin Chan 08.31.2017

                                  What is required to open the sample V17.1 project?  I used VS2015 to open the solution but failed to load the project DevExpressASPNETCoreReporting.  The error is

                                  error  : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. 

                                • Yaroslav (DevExpress Support) 09.01.2017

                                  Hi Edwin,
                                  The "ASP.NET Core Reporting v17.1.zip" project attached to this post targets .NET Core 1.6 framework, which is not supported by Visual Studio 2015. You need to install VS 2017 instead (the 'Community' edition is fully supported). Should you have further questions, let us know.

                                  Regards,
                                  Yaroslav

                                • Tim Ball 1 09.19.2017

                                  Hi guys, is there an updated version of this project for core 2.0 please?

                                  I'm specifically having trouble getting the ReportStorageWebExtension.RegisterExtensionGlobal() to work, as the changes for 2.0 have altered the way the Configure() and ConfigureServices() functions operate at launch?!

                                • Vasily (DevExpress Support) 09.20.2017

                                  Hi Tim,

                                  I upgraded all Microsoft NuGet packages in the sample project provided above up to the version 2.0.0 (ASP.NET Core 2.0) and added the code provided Allow referencing dlls article to make Razor engine resolve DevExpress assemblies. You can find the modified sample project in the attachment. Note that I did not experience any issues with the RegisterExtensionGlobal method after upgrading this project to ASP.NET Core 2.0.

                                • Tim Ball 1 09.21.2017

                                  Thank you Vasily, it was a  mix of issues I was having, but it was mostly that "Allow Referencing dlls" bit that was causing me problems! :-/

                                  I use dependency injection on my custom storage, and as such cannot register it in the configure function anymore. Have moved it to the Program.cs => Main() instead, as recommended on msdn for the migrations:
                                  https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/#update-main-method-in-programcs

                                  [C#]
                                  namespace Reporting { public class Program { public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { //apply migrations var reportingContext = services.GetRequiredService<ReportingDbContext>(); reportingContext.Database.Migrate(); } catch(Exception ex) { var logger = services.GetRequiredService<ILogger<Program>>(); logger.LogError(ex, "An error occurred migrating the DB."); } try { //setup devexpress reports storage ReportStorageWebExtension.RegisterExtensionGlobal(services.GetRequiredService<CustomReportStorageWebExtension>()); } catch (Exception ex) { var logger = services.GetRequiredService<ILogger<Program>>(); logger.LogError(ex, "An error occurred setting up the report storage."); } } host.Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); } }

                                  Thanks for your help.

                                • Vasily (DevExpress Support) 09.21.2017

                                  I am happy to hear that you have managed to resolve this issue, Tim! Thank you for sharing your solution with us.

                                • Vasily (DevExpress Support) 11.17.2017

                                  Starting with version 17.2 you can use our Reporting controls in ASP.NET Core applications targeting .NET Framework by using built-in extensions. Please refer to the ASP.NET Core Reporting (.NET Framework)  help topic to learn how to use these extensions.
                                  You can also download a sample project that demonstrates this approach in action here: T577088: How to use Reporting Controls in ASP.NET Core applications.

                                  Note that in the 17.2** version these extensions are available as a Community Technology Preview.

                                • NCSP 01.23.2018

                                  Hello!
                                  Please say my how you Add CategoriesReport.cs in ASP.NET Core 2.0 Reporting v17.1.zip

                                  Thanks for your help.

                                • Vasily (DevExpress Support) 01.23.2018

                                  Hi,

                                  Your question is not completely clear to me. Do you wish to preview a CategoriesReport in the ASP.NET Core application? If so, would you please clarify whether you have tried to return this report as a result in the ASPNETCoreReportResolver class's implementation, once a report is called by its URL?

                                  *P.S. Note that starting with version 17.2 we recommend using the approach demonstrated in the  ASP.NET Core Reporting (.NET Framework)   help topic to integrate our reporting components to an ASP.NET Core application.

                                • Eric Bauer 1 04.17.2018

                                  Hi there, I have tried the steps in that article for my project which is running on the ASP.NET Core v2.1.0-preview2-26406-04, and I am getting the following error:

                                  Restoring packages for C:\Source\Census Api\Census.API\Census.API.csproj...
                                  Installing DevExpress.AspNetCore.Reporting 17.2.7-ctp.
                                  NU1701: Package 'DevExpress.AspNetCore.Reporting 17.2.7-ctp' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
                                  Package restore failed. Rolling back package changes for 'Census.API'.
                                  Time Elapsed: 00:00:10.3787028
                                  ========== Finished ==========

                                  Do you plan on supporting Core 2.1?

                                • Yaroslav (DevExpress Support) 04.18.2018

                                  Hi Eric,
                                  This issue is caused by the fact that XtraReports can be used only in ASP.NET Core Web Application (.NET Framework)  projects. For now, it is not possible to add XtraReports to an ASP.NET Core Web Application (.NET Core)  application.
                                  >>Do you plan on supporting Core 2.1?
                                  Yes, .NET Core support is on our roadmap and it's planned for the next official release - 18.1. Please keep an eye on our news channels and I'm sure you won't miss anything.

                                  Regards,
                                  Yaroslav

                                0 Solutions

                                Creation Date Importance Sort by