Click on the Start Debugging button (green arrow) in the Debug Toolbar in Visual Studio to run your app.
Once the app is running, you can apply code changes to the running app by clicking the Hot Reload button.
You can stop the app at any time by clicking on the Stop button in the top toolbar.
The first time you run a web app in Visual Studio, it will set up a development certificate for hosting the app over HTTPS and then prompt you to trust the certificate. We recommend agreeing to trust the certificate. The certificate will only be used for local development, and without it most browsers will complain about the security of the website.
Wait for the app to launch in the browser. Once you get to the following page, you have successfully run your first Blazor app!
In your terminal, run the following command:
dotnet watch command will build and start the app, and then update 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:<port number> and for the browser to launch at that address.
Wait for the app to display that it's listening on http://localhost:<port number> and then open a browser and navigate to that address. In this example,
dotnet watch showed it was listening on
Once you get to the following page, you have successfully run your first Blazor app!
The displayed page is defined by the
Index.razor file located inside the
Pages directory. This is what its contents look like:
@page "/" <PageTitle>Index</PageTitle> <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.