Create a Project from Command Line
- 3 minutes to read
You can use a command line interface to create DevExpress-powered projects for Blazor.
Step 1. Install DevExpress CLI Templates
Execute the following command to install DevExpress Blazor project templates from nuget.org:
dotnet new install DevExpress.Blazor.ProjectTemplates
You may get the following error: NU1101: Unable to find package DevExpress.Blazor.ProjectTemplates. If you do, check whether the nuget.org source is enabled. To get a list of sources with their status information, call dotnet nuget list source
. To enable a source, call 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.
Tip
DevExpress CLI project templates are also available in the DevExpress NuGet Gallery (nuget.devexpress.com).
Step 2. Obtain Your NuGet Feed Credentials
You need to obtain your personal NuGet feed credentials to access the DevExpress.Blazor NuGet package from your project. You can use the NuGet feed URL or feed authorization key to manage DevExpress packages.
Step 3. Create a Blazor Project
Execute the following command to create a Blazor project in the current directory:
dotnet new dx.blazor -n <project name>
Command Line Options
To see the full list of available command line options, use one of the following flags: -?
, -h
, or --help
:
dotnet new dx.blazor -h
- -n, –name <name>
- Solution name. If omitted, the command uses the name of the output directory.
- -o, –output <output>
- Specifies the output directory.
- –dry-run
- Displays a summary of what would happen if you run the given command.
- –force
- Forces content to be generated even if it would change existing files.
- –no-update-check
- Disables the check for template package updates when instantiating a template.
- –project <project>
- The project that should be used for context evaluation.
- -lang, –language <C#>
- Specifies the template’s programming language.
- –type <solution>
- Specifies the template type.
- -int, –interactivity <choice>
- Specifies the hosting platform for interactive components.
- -ai, –all-interactive
- Makes every page interactive (applies interactive render mode at the top level). If false, pages use static server rendering by default, and can be marked interactive on a per-page or per-component basis.
- -au, –auth <Individual|None>
- Specifies the authentication type.
- -th, –theme <theme>
- Chooses a built-in DevExpress theme or a Bootstrap theme.
- -sz, –size <Large|Medium|Small>
- Specifies the global size mode for DevExpress Blazor components. Individual component settings can override this option in their code.
- –add-resources <resources>
- Adds specified component packages and registers their static resources.
- –add-ai-resources <services>
- Registers the selected LLM service for AI-powered DevExpress components.
Note
All command options are case-insensitive.
Examples
Create a basic ASP.NET Core Blazor Application project named “MyBlazorServerApp”.
dotnet new dx.blazor --name MyBlazorServerApp
Create an ASP.NET Core Blazor Application project with OpenAI LLM Service. Apply DevExpress Blazing Berry theme to the project.
dotnet new dx.blazor --name MyBlazorServerApp --add-ai-resources OpenAI --theme BlazingBerry