Dotnet Cli: Create A New Project Manage Project Dependencies Test

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Microsoft CHEATSHEET FOR

.NET
DOTNET CLI
CREATE A NEW PROJECT MANAGE PROJECT DEPENDENCIES TEST
Create a new project in the current folder Add a reference to another project Run the tests
dotnet new [TEMPLATE] dotnet add reference [PROJECT_PATH] dotnet test
dotnet new web dotnet add reference ../MyLib/MyLib.csproj
Run the tests and create test report
Create a new project in a subfolder Remove a project reference dotnet test --logger "trx;LogFileName=results.trx"
dotnet new [TEMPLATE] -o [NAME] dotnet remove reference [PROJECT_PATH]
dotnet new web -o Backend dotnet remove reference ../MyLib/MyLib.csproj List all tests without running them
dotnet new mvc -o MyApp dotnet test -t
dotnet new console -o MyApp List all project references
dotnet new classlib -o MyLib dotnet list reference Run specific tests
dotnet new mstest -o MyLib.Test dotnet test --filter "[FILTER]"
dotnet new nunit -o MyLib.Test Add a Nuget package dotnet test --filter Unit
dotnet add package [PACKAGE] dotnet test --filter "TestCategory=Database"
Get the list of installed templates dotnet add NewtonSoft.Json dotnet test --filter "TestCategory!=Slow"
dotnet new dotnet test --filter "Unit&(TestCategory=Cat1)"
Remove a Nuget package
dotnet remove package [PACKAGE]
MANAGE SOLUTIONS FILES (.SLN) dotnet remove NewtonSoft.Json PUBLISH
Create a new .sln file List all project references Publish the project or solution from the current folder
dotnet new sln dotnet list package dotnet publish
Create a new .sln file in a subfolder Publish specific project or solution
dotnet new sln -o MySolution BUILD dotnet publish [FOLDER]
dotnet publish MyApp
List all projects in the solution Build the project or solution in the current folder
dotnet sln list dotnet build Build a self-contained executable for Windows
dotnet publish -c Release -r win-x64 -f netcoreapp2.2
Add a project to the solution Build the Release configuration
dotnet sln add [PROJECT_PATH] dotnet build -c Release Build a self-contained executable for Linux
dotnet sln add MyLib\MyLib.csproj dotnet publish -c Release -r linux-x64 -f netcoreapp2.2
Build the project or solution
Remove a project from the solution dotnet build [PROJECT/SOLUTION]
dotnet sln remove [PROJECT_PATH] dotnet build MySolution.sln GLOBAL TOOLS
dotnet sln remove MyLib/MyLib.csproj
Install a global tool
NUGET dotnet tool install -g [TOOLNAME]
RUN
Create a nuget package Uninstall a global tool
Run an application dotnet pack dotnet tool uninstall -g [TOOLNAME]
dotnet run
Publish a nuget package List all globally installed tools
dotnet nuget push dotnet tool list -g

DOTNET CLI CHEATSHEET v1.0.1 by martin.kramer@lostindetails.com

You might also like