Use .NET CLI to Create a Blazor Reporting Application from Template
- 3 minutes to read
You can use the .NET command line interface (CLI) to create an ASP.NET Core Reporting application from the console:
Prerequisites
You need a configured private DevExpress NuGet source to create an application using the .NET Core CLI Tools.
If you have already configured a private DevExpress NuGet source, proceed to step 1. Otherwise, add a private DevExpress NuGet source as described in the following help topic: Manage Packages with .NET CLI.
Step 1. Install DevExpress CLI Templates
Open the console and enter the following command:
dotnet new install DevExpress.DotNet.Web.ProjectTemplates::23.1.10
The console displays the list of templates installed on your machine from this package.
Step 2. Create a Blazor Reporting Application
Generate a Blazor Server Reporting Application
Run the following command to generate an application:
dotnet new dx.blazor.reporting.blazorserver --name BlazorReportingServerApp
Generate a Hosted Blazor WebAssembly Reporting Application
Run the following command to generate an application:
dotnet new dx.blazor.reporting.webassembly.hosted --name BlazorReportingWasmHostedApp
Generate a Blazor WebAssembly Reporting Application
Run the following command to generate an application:
dotnet new dx.blazor.reporting.webassembly --name BlazorReportingWasmApp
Options for Blazor Server and Hosted Blazor WebAssembly Applications
Specify the following command line parameters to customize the project:
-ad | --add-designer
(optional)- Specifies whether to create a web page with the Report Designer (JS-Based). The default value is
true
. -adv | --add-document-viewer
(optional)- Specifies whether to create a web page with a Document Viewer (JS-Based). The default value is
true
. -arv | --add-report-viewer
(optional) (only Blazor Server)- Specifies whether to create a web page with a Report Viewer (a native Blazor component for Blazor Server). The default value is
true
. -ads | --add-data-source
(optional)- 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
false
. -ajs | --add-json-data-connection-storage
(optional)- 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
(optional)- 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
.
Step 3. Run the Application
Blazor Server Reporting Application
Navigate to the application folder and download client resources.
cd BlazorReportingServerApp npm install
Restore dependencies, build the application, and run the project:
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.
Hosted Blazor WebAssembly Reporting Application
Navigate to the application folder:
cd BlazorReportingWasmHostedApp
Restore dependencies, build the application, and run the project:
dotnet run --project BlazorReportingWasmApp.Server
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.
Blazor WebAssembly Reporting Application
Navigate to the application folder:
cd BlazorReportingWasmApp
Restore dependencies, build the application, and run the project:
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.