Skip to content

Instantly share code, notes, and snippets.

@izackp
Last active March 31, 2020 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izackp/02616a1547543853111f90c6b8c519de to your computer and use it in GitHub Desktop.
Save izackp/02616a1547543853111f90c6b8c519de to your computer and use it in GitHub Desktop.
dotnet cli cheat sheet
Description Command
Create New Solution dotnet new sln
Create New Library dotnet new classlib -o library
Add Project to Solution dotnet sln add library/library.csproj
Add Nueget Package to Project dotnet add library package Newtonsoft.Json
Fix Dependencies dotnet restore
Build Solution dotnet build
Create Unit Test Project dotnet new xunit -o test-library
Add Project to Solution dotnet sln add test-library/test-library.csproj
Add Project to Test Project dotnet add test-library/test-library.csproj reference library/library.csproj
Run Test with Project dotnet test test-library/test-library.csproj
Create New Console App dotnet new console -o console-app
Add Project to Solution dotnet sln add console-app/console-app.csproj
Add Project to Project dotnet add console-app/console-app.csproj reference library/library.csproj
Run project and Print Result dotnet run -p console-app/console-app.csproj
Create SelfContained Exe. dotnet publish -r osx-x64
Create SelfContained Exe. dotnet publish -r win-x64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment