Skip to content

Instantly share code, notes, and snippets.

@greglecki
Last active October 27, 2021 21:13
Show Gist options
  • Select an option

  • Save greglecki/b98bea497c7eae61fad523b0b72d3c9f to your computer and use it in GitHub Desktop.

Select an option

Save greglecki/b98bea497c7eae61fad523b0b72d3c9f to your computer and use it in GitHub Desktop.
Dot Net CLI Commands

Create solution

dotnet new sln

dotnet new sln --name MyForms.ContentHUB

Create project

dotnet new classlib -n PROJECT_NAME -o PROJECT_OUTPUT_DIRECTORY

dotnet new classlib -n my-forms.management.repositories -o ./my-forms.management.repositories

Add project to solution

dotnet sln add PROJECT

dotnet sln add ./my-forms.management.repositories/

Add project reference

dotnet add MAIN_PROJECT reference REFERENCE_PROJECT

dotnet add ./my-forms.management.domain/ reference ./my-forms.management.common/

Add Nuget package

dotnet add PROJECT package PACKAGE NAME

dotnet add ./my-forms.management.repositories/ package Microsoft.EntityFrameworkCore

EF

Install EF tools

dotnet tool install --global dotnet-ef

Export path

export PATH="$PATH:/home/vscode/.dotnet/tools"

Add db migration

dotnet ef migrations add <MIGRATION_NAME> --project <DB_PROJECT> --startup-project <STARTUP_PROJECT>

dotnet ef migrations add InitialCreate --project ./src/MyForms.ContentHub.Repositories/ --startup-project ./src/MyForms.ContentHub.Api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment