The .NET SDK and the dotnet CLI

1 min read

The .NET SDK

The .NET SDK (Software Development Kit) is a set of tools, libraries and runtimes that developers use to create .NET applications and libraries. It includes the .NET CLI, the .NET runtime (CoreCLR), the Base Class Library (see the BCL noteThe BCL and CoreLibThe libraries every .NET program stands on, and the one assembly the runtime cannot start without.Opens in a new tab), and language compilers like Roslyn for C#.

The .NET CLI

The dotnet command is a cross-platform toolchain for developing, building, running, testing and publishing .NET applications. It’s a cornerstone of .NET development, especially in cross-platform and CI/CD scenarios. Key commands:

Command What it does
dotnet new <TEMPLATE> Creates a new project or solution from a template, for example dotnet new console or dotnet new webapi.
dotnet restore Restores the project dependencies specified in the .csproj file.
dotnet build Compiles the project and its dependencies.
dotnet run Builds and runs the application.
dotnet test Runs the unit tests in the project.
dotnet publish Publishes the application and its dependencies to a folder for deployment.
dotnet add package <PACKAGE_NAME> Adds a NuGet package reference to the project.
dotnet sln add <PROJECT_PATH> Adds a project to a solution file.

Sources