Blazor Tutorial - Build your first Blazor app

Run your app

In your command prompt, run the following command:

In your terminal, run the following command:

Command prompt
dotnet watch run

The dotnet watch run command will build and start the app, and then rebuild and restart the app whenever you make code changes. You can stop the app at any time by selecting Ctrl+C.

Wait for the app to display that it's listening on http://localhost:5000 and for the browser to launch at that address.

Wait for the app to display that it's listening on http://localhost:5000 and then open a browser and navigate to that address.

Once you get to the following page, you have successfully run your first Blazor app!

The home page of your site contains some text and presents several tabs on the left to click and explore.

The displayed page is defined by the Pages/Index.razor file. This is what its contents look like:

Pages/Index.razor
@page "/"

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

It already contains the code that sets it as the homepage and displays the text "Hello, world!" and "Welcome to your new app". It also includes a SurveyPrompt component that renders a link to the Blazor feedback survey.

Continue