Live Chat Icon For mobile
Live Chat Icon

Blazor FAQ - Getting started

Find answers for the most frequently asked questions
Expand All Collapse All

Follow these steps to create a Blazor WebAssembly (client-side) application using a command-line interface (CLI).

  1. Create a Blazor WebAssembly App in CLI

    Open a command prompt where you want your project to be located and run the following command.

    dotnet new blazorwasm -o BlazorWebAssemblyApp

    Blazor WASM CLI

  2. Navigate to Blazor WebAssembly App

    Run the cd BlazorWebAssemblyApp command to navigate to the BlazorWebAssemblyApp folder.

  3. Run the application.

    The dotnet run command runs the application. See the following output in the default browser.

    wasm cli host

Note: If you have installed multiple SDK versions and need a specific framework version (e.g., net5.0, netcoreapp3.1) project, then add the -f flag to the dotnet new blazorwasm command. Refer here for the available flag options.

Permalink

Follow these steps to create a Blazor Server application using a command-line interface (CLI).

  1. Create a Blazor Server App in CLI

    Open a command prompt where you want your project to be located and run the following command.

    dotnet new blazorserver -o BlazorServerApp

    blazorserver cli

  2. Navigate to Blazor Server App

    Run the cd BlazorServerApp command to navigate to the BlazorServerApp folder.

  3. Run the apllication.

    The dotnet run command runs the application. See the following output in the default browser.

    server-cli-output

Refer to this documentation for more details.

Permalink

Follow the step-by-step procedure below to create a Blazor Server Application in Visual Studio 2019.

  1. Download and install Visual Studio 2019

    Download and install the latest version of Visual Studio 2019 with the ASP.NET and web development workload.

  2. Create a new project

    Open Visual Studio 2019 and click Create a new project . create new project

  3. Select Blazor app from the template

    Select Blazor App from the template list and click the Next button.
    blazor template

  4. Configuring the project

    The project configuration window will pop up. Click the Create button to create a new project with the default project configuration.
    Blazor server configure

  5. Choose Blazor Server App

    Select a target framework based on your requirement, choose the Blazor Server App from the dashboard, and then click Create to create a new Blazor Server application.

    Blazor server template

  6. Blazor Server App structure

    Now the Blazor Server App is created, and the structure look like the following image.
    Server structure

  7. Run the application.

    Press Ctrl + F5 to run the application and find the output in default browser.
    server output

Refer to this link for more details.

Permalink

Follow the step-by-step procedure below to create a Blazor WebAssembly (client-side) application in Visual Studio 2019.

  1. Download and install Visual Studio 2019

    Download and install the latest version of Visual Studio 2019 with the ASP.NET and web development workload.

  2. Create a new project

    Open Visual Studio 2019 and select Create a new project .
    create new project

  3. Select Blazor app from the template

    Select Blazor App from the template list and click the Next. blazor template

  4. Configuring the project

    The project configuration window will pop up. Click Create button to create a new project with the default project configuration.
    Blazor server configure

  5. Choose Blazor WebAssembly App

    Select a target framework based on your requirements, choose Blazor WebAssembly App from the dashboard, and then click Create to create a new Blazor WebAssembly application.

    blazor wasm template

  6. Blazor WebAssembly App structure

    Now the Blazor WebAssemblyApp is created, and the structure look like in the below image.
    wasm structure

  7. Run the application.

    Press ctrl + F5 to run the application and see the below output in default browser.
    wasm output

Refer to this link for more details.

Permalink

Share with

Share on twitter
Share on facebook
Share on linkedin

Couldn't find the FAQs you're looking for?

Please submit your question and answer.