Skip to content

Misc CLI Tools

Simon Geering edited this page Jul 9, 2023 · 11 revisions

CLI Tools

Notes on the use of various CLI tools utilised by the project.

Assume starting from src folder.

Entity framework CLI commands

EF migrations are kept in DAL to allow adding other Apps in future with a common DB.


dotnet ef migrations script --output "./AdminAssistant.Infra/DAL/EntityFramework/Migrations/Sqlite/Initial.sql" --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj"

dotnet ef migrations script --output "./AdminAssistant.Infra/DAL/EntityFramework/Migrations/TSQL/Initial.sql" --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj"

dotnet ef database update --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj" --no-build

dotnet ef migrations add Initial --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj" --output-dir "./DAL/EntityFramework/Migrations" --no-build

dotnet ef migrations list --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj" --no-build

dotnet ef migrations remove --context applicationdbcontext --project "./AdminAssistant.Infra/AdminAssistant.Infra.csproj" --startup-project "./AdminAssistant.Blazor.Server/AdminAssistant.Blazor.Server.csproj" --no-build

Install Global tools

dotnet tool list --global
dotnet tool uninstall --global dotnet-ef
dotnet tool install dotnet-ef --global --version 7.0.4 --interactive
dotnet tool update --global dotnet-ef --version 7.0.4

Testing Commands

Run unit tests with a file watcher; assumes the shell is in /src/AdminAssistant.Test/

dotnet watch test --filter "Category=Unit" --nologo --no-restore