.NET console commands

Updated: 21 June 2023

Build a project and its dependencies using Release configuration

dotnet build --configuration Release

Build and test the Release version of a console application

dotnet run --configuration Release

Run the tests in the project in the current directory

dotnet test

Publishes the application and its dependencies to a folder for deployment to a hosting system.

dotnet publish

Build the project and its dependencies into a set of binaries. The binaries include the project’s code in Intermediate Language (IL) files with a .dll extension.

dotnet build

Clean up the output of the previous build. Both intermediate (obj) and final output (bin) folders are cleaned.

dotnet clean

Restores the dependencies and tools for a project i.e. external libraries in NuGet packages. All dependencies become available in a local cache and can be used by the .NET CLI to build and run the application.

dotnet restore