Use .NET CLI Template to Create an ASP.NET Core Reporting Application with Document Viewer
- 4 minutes to read
You can use command line interface (CLI) to create an ASP.NET Core Reporting application with a Web Document Viewer and/or Web Report Designer.
Install DevExpress CLI Templates
Execute the following command to install DevExpress ASP.NET Core project templates from nuget.org:
dotnet new install DevExpress.AspNetCore.ProjectTemplates
If the NuGet.org package source is disabled, you will get the following error: NU1101: Unable to find package DevExpress.AspNetCore.ProjectTemplates. To see the list of sources and their status information, run the command dotnet nuget list source
. To enable a source, run the command dotnet nuget enable source <source name>
.
If you are new to NuGet, visit the following page for more information about package management prerequisites: An Introduction to NuGet.
Create a Project
To create an ASP.NET Core Reporting application with both the Web Document Viewer, execute the following command:
dotnet new dx.aspnetcore.reporting -n DxReportingApp --add-designer false
The command creates an ASP.NET Core Reporting application called DxReportingApp in the current directory.
You can use the following parameters to see available command options: -? | -h | --help
. For example, execute the following command:
dotnet new dx.aspnetcore.reporting --help
Refer to the following documents for information on template options:
- dotnet new command - Options
- Standard options for .NET CLI templates.
- Template Options
- Options specific to the DevExpress ASP.NET Core Reporting template.
Run the Project
Navigate to the newly created application folder and use the following command to restore dependencies, run the application, and display the application’s URL:
cd DxReportingApp
dotnet run
The command output contains the application URL, which can be different on different hosts:
Now listening on: http://localhost:2009
Open your browser and navigate to the URL specified in the command output to see the result.
Template Options
The following list contains options you can specify when creating DevExpress ASP.NET Core Reporting project templates:
-prerelease, --use-prerelease-dx-version
- A flag that indicates whether to use a pre-release DevExpress package version in the project.
--framework <TFM>
- Specifies the target framework. It expects a target framework moniker (TFM). Example:
net8.0
. --dx-version <version>
- Specifies DevExpress package version to be used in the project. Examples:
24.2.3
,24.2.*
,24.2.*-*
--dx-nuget-feed <feed>
- Specifies the NuGet Feed URL. Refer to nuget.devexpress.com to obtain your personal feed URL (available for registered users).
-ad, --add-designer
Specifies whether to create a web page with the Report Designer.
The default value is
true
.-av, --add-viewer
Specifies whether to create a web page with the Document Viewer.
The default value is
true
.-ads, --add-data-source
Specifies whether to create a sample connection string and register it in the Report Designer to create SQL Data Sources in the Report Wizard and Data Source Wizard. The connection string is also used to register a predefined data source.
The default value is
true
.-ajs, --add-json-data-connection-storage
Specifies whether to create a storage and register it to create JSON Data Sources in the Report Wizard and Data Source Wizard.
The default value is
true
.For the storage to work correctly, ensure that the System.Text.Json (default) or Newtonsoft.Json library is installed. Set the
DevExpress.DataAccess.Native.Json.JsonLoaderHelper.ProcessingLibrary
property toNewtonsoftJson
to use the Newtonsoft.Json library.-ao, --add-data-object
Specifies whether to add a sample data object to an application and register this data object to create Object Data Sources in the Report Wizard and Data Source Wizard.
The default value is
false
.-rte, --enable-rich-text-editor
Specifies whether to add an in-line Rich Text Editor for the RichText control.
The default value is
false
.-dfb, --Dockerfile <None|Debian|...>
Creates a Dockerfile based on the selected OS. Review the following online example for more information: How to Use the SkiaSharp-Based DevExpress Drawing Engine. Select
None
to skip Docker support.- None (default)
- Skip docker support.
- Debian
- Debian-based Dockerfile.
- Alpine
- Alpine-based Dockerfile.
- Ubuntu
- Ubuntu-based Dockerfile.
- openSUSE
- openSUSE-based Dockerfile.
- Amazon Linux
- Amazon Linux based Dockerfile.
-D, --DocumentStorage <InMemory|XPO|...>
- Specifies the storage type to cache documents that the report creates. For more information, review the following help topic: Web Document Viewer Cache Management.
- InMemoryStorage (default)
- Default cache that stores objects directly in memory without serialization, optimized for frequent operations.
- XPOStorage
- Implements database cache based on the XPO library, designed for multi-instance applications to prevent cache data loss.
- FileStorage
- Configures the reporting engine to store documents generated by reports on disk instead of in memory.
- DistributedCache
- Enables cache as external service that uses ASP.NET Core distributed caching mechanism and can be shared by multiple application servers.
- AzureStorage
- Configures the application to use Azure caching services.
Troubleshooting
The following article lists common issues that can occur in a Web Reporting application and describes solutions: Troubleshooting
For information on how to identify the cause of an issue, refer to the following topic: Reporting Application Diagnostics.