Skip to main content

Create a Blazor Web App

  • 4 minutes to read

This topic contains detailed instructions on how to create Blazor Web App applications from both DevExpress and Microsoft templates in Visual Studio and the .NET CLI.

Important

Ensure your system meets these requirements.

The following options are available:

Note

We implemented a new dotnet CLI-powered Project Wizard you can use across multiple IDEs. The new wizard suggests many additional presets: Cross-IDE Project Template Kit.

Watch Video: Creating a Blazor Web App Using DevExpress Templates (.NET 8)

Watch Video: Adding DevExpress Blazor Components to an Existing Project (.NET 8)

Follow the steps below to run the DevExpress Template Gallery in Visual Studio:

  1. Open Visual Studio and click Create a new project on the start page.

  2. In the Create a New Project dialog, select DevExpress v24.2 Blazor App Template Gallery and click Next.

    Create a new application

  3. Specify the Project Name and Location, and click Create.

  4. In the invoked Template Gallery, specify Project Name, Target Framework, Render Mode, and Authentication options, and click Run Wizard.

    Template Gallery

  5. The Project Wizard appears.

    Project Wizard - Themes

    The wizard includes the following tabs:

    Themes. Choose a built-in DevExpress theme or a Bootstrap theme.

    Settings. This tab contains a different set of options for Blazor Server and WebAssembly applications:

    • Component Size Mode - Specifies the size mode for DevExpress Blazor components. The wizard adds the SizeMode global option in the Program.cs file. Individual component settings can override this option.
    • Add Rich Text Editor Resources - Adds Rich Text Editor packages to the project, imports the DevExpress.Blazor.Office and DevExpress.Blazor.RichEdit namespaces, and registers CSS resources for the Rich Editor component.
  6. Click Create Project in the wizard.

Visual Studio: DevExpress Template

  1. Open Visual Studio and click Create a new project on the start page.
  2. Select the DevExpress Blazor App (Developer Express Inc.) template and click Next.

    Blazor App

  3. Specify Project Name and Location, and click Next.

  4. Specify Framework, Authentication Type, and Render Mode, and click Create.

.NET CLI: DevExpress Template

Based on the render mode, run one of the following commands to create a project:

dotnet new dx.blazor -n MyBlazorInteractiveServerApp -f net8.0 -int Server 

The newly created project references the DevExpress.Blazor NuGet package. NuGet automatically restores this package if you registered the DevExpress NuGet feed.

You can also pass the NuGet feed as a -nf parameter when you create a project. The following command creates the project and adds the NuGet.config file with the DevExpress feed to the project folder.

dotnet new dx.blazor -n MyBlazorServerApp -nf https://nuget.devexpress.com/{your-feed-authorization-key}/api/v3/index.json

To see the list of available template options, execute the following command:

dotnet new dx.blazor -h

Template options

Visual Studio: Microsoft Template

Follow the steps below to use Microsoft Blazor project templates in Visual Studio:

  1. Click Create a new project on Visual Studio’s start page, select a Blazor template based on your content and hosting model preferences, and click Next.

    All Microsoft Templates

  2. Specify project name and location. Click Next.

  3. Specify additional options (for example, render mode), and click Create.

.NET CLI: Microsoft Template

Based on the render mode, run one of the following commands to create a project:

dotnet new blazor -n MyBlazorInteractiveServerApp

Next Step

If you created a project from a DevExpress template and successfully restored NuGet packages, click the following button:

Read Tutorial: Add DevExpress Components to an Application

Otherwise, proceed to the following step:

Read Tutorial: Set Up the DevExpress Nuget Package in the Application