---
logosub: "Software"
language: "en"
title: "Blazor commands"
code: "Blazor"
---

A collection of commands useful to work with blazor web applications.


* Create a new application.

`dotnet new blazor -o BlazorWebAppMovies`

* Compile and run the application, and hot-reload upon changes.

`dotnet watch`

* VS Code build:

Command Palette (Ctrl+Shift+P), use the `.NET: Build` command to build the app.

* Create gitignore file:

`dotnet new gitignore`

* [Scaffolding example](https://learn.microsoft.com/en-us/aspnet/core/blazor/tutorials/movie-database-app/part-2?view=aspnetcore-8.0&pivots=vsc#scaffold-the-model):

`dotnet aspnet-codegenerator blazor CRUD -dbProvider sqlite -dc BlazorWebAppMovies.Data.BlazorWebAppMoviesContext -m Movie -outDir Components/Pages`


### Entity framework

* Create a migration, this is also used when creating a new migration when the model has changed.

`dotnet ef migrations add InitialCreate`

* Update the database:

`dotnet ef database update`

