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.
Once you get to the following page, you have successfully run your first Blazor app!
The displayed page is defined by the
Home.razor file located inside the
Components/Pages directory. This is what its contents look like:
@page "/" <PageTitle>Home</PageTitle> <h1>Hello, world!</h1> Welcome to your new app.
It already contains the code that sets it as the homepage and displays the text
Hello, world! and
Welcome to your new app. The
PageTitle component sets the title for the current page so that it shows up in the browser tab.
If you receive an error message saying "Your connection is not private" with error code NET::ERR_CERT_INVALID, try to restart all browser windows so the new certificate can be picked up by the browser and run the application again.
If you can't resolve the issue you're having, select the I ran into an issue button below to get help fixing the problem.