Use .NET CLI Template to Create a Blazor Reporting Application
- 4 minutes to read
You can use command line interface (CLI) to create an Blazor Reporting application. The project templates allow you to create the following applications:
- Blazor Server Application with a Report Viewer (Native or JavaScript-based) and/or JavaScript-based Report Designer
- Blazor WebAssembly (Standalone) Application with a Report Viewer (Native or JavaScript-based) and/or JavaScript-based Report Designer
- Blazor WebAssembly (Hosted) Application with a JavaScript-based Report Viewer and Report Designer
Install DevExpress CLI Templates
Execute the following command to install DevExpress Blazor project templates from nuget.org:
dotnet new install DevExpress.Blazor.ProjectTemplates
If the NuGet.org package source is disabled, you will get the following error: NU1101: Unable to find package DevExpress.Blazor.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.
Note
DevExpress CLI project templates are also available in the DevExpress NuGet Gallery (nuget.devexpress.com).
Create a Project
TTo create a Blazor Reporting application with both Web Document Viewer and Web Report Designer, execute the following command:
dotnet new dx.blazor.reporting -n DxReportingApp
The command creates a Blazor Reporting application called DxReportingApp in the current directory. The application includes a Native Report Viewer, JavaScript-based Report Viewer and JavaScript-based Report Designer.
You can use the following parameters to see available command options: -? | -h | --help
. For example, execute the following command:
dotnet new dx.blazor.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
Tip
Ensure required workloads for Blazor WebAssembly applications are installed.
To run a Blazor Server or standalone Blazor WebAssembly application,
Navigate to the application folder and execute the dotnet run
command to restore dependencies and run the application.
cd DxReportingApp
dotnet run
For hosted Blazor WebAssembly applications, run the command from the DxReportingApp.DxReportingApp.Server folder:
cd DxReportingApp.DxReportingApp.Server
dotnet run
The command output contains the application URL:
Now listening on: http://localhost:5000
Open your browser and navigate to the URL 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.*-*
-int, --interactivity
Chooses which hosting platform to use for Blazor Reporting Components.
The default value is
Server
.Available options are:
- Server
- Runs on the server.
- WebAssembly
- Runs in the browser using WebAssembly.
- Hosted
- Runs in the browser using WebAssembly with an ASP.NET Core app as a backend.
-ad | --add-designer
Specifies whether to create a web page with the Report Designer (JS-Based).
The default value is
true
.-adv | --add-document-viewer
Specifies whether to create a web page with a Document Viewer (JS-Based).
The default value is
true
.-arv | --add-report-viewer
(Only for Blazor Server and standalone Blazor Webassembly apps.)Specifies whether to create a web page with a Report Viewer (a native Blazor component).
The default value is
true
.-ads | --add-data-source
(Only for Blazor Server and hosted Blazor Webassembly Hosted apps.)Specifies whether the application should register a sample connection string. The specified connection allows end users to create SQL Data Sources in the Report Wizard and Data Source Wizard.
The default value is
true
.-ajs | --add-json-data-connection-storage
Specifies whether the application should create and register a JSON storage. That storage allows users to create JSON Data Sources in the Report Wizard and Data Source Wizard.
The default value is
false
.-ao | --add-data-object
(Only for Blazor Server and hosted Blazor Webassembly apps.)Specifies whether the application code should create and register a sample data object. Data objects allow users to create Object Data Sources in the Report Wizard and Data Source Wizard.
The default value is
false
.-dfb, --Dockerfile <None|Debian|...>
(Only for Blazor Server and hosted Blazor Webassembly apps.)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 not enable 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.
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.