Skip to content

Getting Started

Thanh Nguyen edited this page May 7, 2025 · 13 revisions

Table of Contents

Prerequisites

Install the template

The Blazor Admin Template is available as a NuGet package. To install it, run:

$ dotnet new install Ddth.Templates.Blazor

If the installation is successful, you should see a message similar to the following:

$ dotnet new install Ddth.Templates.Blazor
The following template packages will be installed:
   Ddth.Templates.Blazor

Success: Ddth.Templates.Blazor::2.0.0 installed the following templates:
Template Name          Short Name  Language  Tags
---------------------  ----------  --------  ------------------------------------------------------------------------------
Blazor Admin Template  bat         [C#]      Blazor/Admin Template/AdminCP/Web API/WebAPI/API/Web Assembly/WebAssembly/WASM

The command above can also be used to update the template package to the latest version. If you already have a previous version installed, you should see a message indicating that the package is being updated:

$ dotnet new install Ddth.Templates.Blazor
The following template packages will be installed:
   Ddth.Templates.Blazor

Ddth.Templates.Blazor (version 1.2.0) is already installed, it will be replaced with latest version.
Ddth.Templates.Blazor::1.2.0 was successfully uninstalled.
Success: Ddth.Templates.Blazor::2.0.0 installed the following templates:
Template Name          Short Name  Language  Tags
---------------------  ----------  --------  ------------------------------------------------------------------------------
Blazor Admin Template  bat         [C#]      Blazor/Admin Template/AdminCP/Web API/WebAPI/API/Web Assembly/WebAssembly/WASM

Verify that the template is available by running:

$ dotnet new list blazor

You should see the bat template listed in the output:

$ dotnet new list blazor
These templates matched your input: 'blazor'

Template Name                      Short Name  Language  Tags
---------------------------------  ----------  --------  ------------------------------------------------------------------------------
Blazor Admin Template              bat         [C#]      Blazor/Admin Template/AdminCP/Web API/WebAPI/API/Web Assembly/WebAssembly/WASM
Blazor Web App                     blazor      [C#]      Web/Blazor/WebAssembly
Blazor WebAssembly Standalone App  blazorwasm  [C#]      Web/Blazor/WebAssembly/PWA

Create a new .NET solution using the template

Once the Blazor Admin Template is installed, you can create a new solution based on the template with the following command:

$ dotnet new bat -n MyApp

This creates a new solution named MyApp in the current directory. Replace MyApp with your desired solution name.

To specify a different output directory, use the -o option:

$ dotnet new bat -n MyApp -o /workspaces/MyApp

After the command completes, you should see the following files and directories created:

$ dotnet new bat -n MyApp -o /workspaces/MyApp
The template "Blazor Admin Template" was created successfully.

$ ls -la /workspaces/MyApp/
total 119
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 ./
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 ../
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096   361 May  6 10:09 .dockerignore
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096 38456 May  6 10:09 .editorconfig
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096   485 May  6 10:09 .gitattributes
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 .github/
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  6914 May  6 10:09 .gitignore
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 dbschema/
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  1925 May  6 10:09 Dockerfile
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  2151 May  6 10:09 Dockerfile.dev
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  1662 May  6 10:09 Dockerfile.win
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  1076 May  6 10:09 LICENSE.md
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Api/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Blazor/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Demo.Api/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Demo.Shared/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Libs/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Shared/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Shared.Api/
drwxr-xr-x 1 SOUTHPACIFIC+thanhn 4096     0 May  6 10:09 MyApp.Shared.EF/
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096 13590 May  6 10:09 MyApp.sln
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096  1670 May  6 10:09 README.md
-rw-r--r-- 1 SOUTHPACIFIC+thanhn 4096   281 May  6 10:09 RELEASE-NOTES.md

The new solution contains the following projects:

BAT Solution Structure

Next steps

Clone this wiki locally