📗
Everyday Cheat Sheets
  • README
  • Build
    • Architecture
      • API Management
        • Kong
      • Authentication
        • Keycloak
        • Okta
      • Cloud Native
      • Design Patterns
      • Design Principles
      • IaC
      • IoT
      • Message Broker
      • Methods
      • Networking
      • Payment
        • Stripe
      • Testing
    • Code lifecycle (ALM)
      • Automation Pipelines
        • Argo CD
        • CircleCI
        • Flux
        • Keptn
        • Travis
      • Azure DevOps
        • Azure Pipelines
      • Chef
      • GitHub
        • GitHub Actions
      • Nexus
      • Promyze
      • RunDeck
      • SaltStack
      • Sonar
      • Tuleap
    • Containers & Cloud Native
      • Argo Workflows
      • Containerization
        • Docker
          • Docker CLI
        • containerd
        • cri-o
      • CNAB
      • Dapr
      • Envoy
      • Fluentd
      • Knative
      • Kubernetes
        • Cluster API
        • etcd
        • Helm
        • k3d
        • kind
        • Kubectl
        • MetalLB
        • Minikube
      • Open Application Model (OAM)
      • Unleash
    • Data storage
      • MySQL
      • MongoDB
        • Atlas
        • Compass
        • Evergreen
        • MongoDB 4.2
        • MongoDB 5.0
        • MongoDB design
        • MongoDB events
        • MongoDB driver for .NET
        • Ops Manager
        • Realm
      • Oracle
      • Redis
      • SQL Server
      • PostgreSQL
    • Frameworks & libraries
      • Angular
        • Angular CLI
        • Angular events
      • .NET
        • ASP.NET Core
        • Blazor
        • .NET 5.0
        • .NET 6.0
        • .NET CLI
        • .NET Core
        • .NET Events
        • .NET Logging
        • .NET Testing
        • NuGet
        • WPF
        • Xamarin
      • gRPC
      • Ionic
      • Jekyll
      • Node.js
        • Express
        • NPM
      • React
        • React Native
      • Redux
    • IDE
      • Visual Studio 2022
    • Languages
      • C#
        • C# 8.0
      • ECMAScript
      • GraphQL
      • JavaScript
        • webpack
        • Yarn
      • MS-DOS
      • PHP
      • PowerShell
      • Python
      • Swagger
      • TypeScript
    • Messaging
      • Azure Service Bus
      • RabbitMQ
    • Testing
    • Workstation
      • QGIS
      • Visual Studio 2019
      • Windows 10
      • Windows Subsystem for Linux
  • Collaborate
    • Marp
    • Microsoft 365
      • Microsoft Graph
      • SharePoint Framework
        • Fluent UI
        • SharePoint Framework UI components
  • Run
    • Cloud computing
      • Alibaba
      • AWS
      • Azure
        • Azure AD
        • Azure CLI
        • Azure Container Registry
        • Azure Portal
        • Azure Service Bus
      • Firebase
      • OVH
    • Hardware
      • Single-board computers
        • Odroid
        • Raspberry Pi
    • Infrastructure automation
      • Azure Resource Manager
      • Packer
      • Pulumi
      • Puppet
      • Terraform
        • HCL
        • Terraform CLI
        • Terraform Providers
    • Networking
      • HAProxy
      • nginx
    • Observability
      • Grafana Labs
        • Grafana
        • Loki
        • Tempo
      • OpenTelemetry
      • Prometheus
      • Splunk
    • Security
      • Falco
    • Systems
      • Linux
        • CentOS
        • eBPF
        • Linux Kernel
        • Rocky
        • Ubuntu
      • Windows Server
    • Virtualization
      • Hyper-V
      • Vagrant
  • Optimize
    • DevOps
  • Join
    • Companies
      • HashiCorp
Powered by GitBook
On this page
  • Content
  • General commands
  • New command
  • Add command
  • Solution command
  • Run command
  • Publish command
  • Test command
  • Tools

Was this helpful?

Export as PDF
  1. Build
  2. Frameworks & libraries
  3. .NET

.NET CLI

Previous.NET 6.0Next.NET Core

Last updated 1 year ago

Was this helpful?

The .NET command-line interface (CLI) is a cross-platform toolchain for developing, building, running, and publishing .NET applications. The .NET CLI is included with the .NET SDK.

→ ,

Content

General commands

Command
Action

dotnet -v

Display information on the installed version

New command

Command
Action

dotnet new

Examples:

  • dotnet new webapi --output src/PalTracker --name PalTracker will use the template "ASP.NET Core Web API"

  • dotnet new xunit --output test/PalTrackerTests --name PalTrackerTestswill use the template "xUnit Test Project"

  • dotnet new sln --name PalTracker will use the template "Solution File"

Add command

Command
Action

dotnet add reference

dotnet add package

Examples:

  • dotnet add test/PalTrackerTests reference src/PalTracker/PalTracker.csproj

  • dotnet add test/PalTrackerTests package Microsoft.AspNetCore.TestHost --version 2.2.0

Solution command

Command
Action

dotnet sln

Examples:

  • dotnet sln PalTracker.sln add src/PalTracker/PalTracker.csproj

Run command

Command
Action

dotnet run

Examples:

  • dotnet run --project src/PalTracker

Publish command

Command
Action

dotnet publish

Examples:

  • dotnet publish src/PalTracker --configuration Release

Test command

Command
Action

dotnet test

Examples:

  • dotnet test test/PalTrackerTests --filter PalTrackerTests.InMemoryTimeEntryRepositoryTest

See also:

Tools

View the available templates (see )

Adds project-to-project (P2P) references (see )

Adds a package reference to a project file (see )

Modifies a .NET Core solution file (see )

Runs source code without any explicit compile or launch commands (see )

Packs the application and its dependencies into a folder for deployment to a hosting system (see )

Run the tests (see )

Passing runsettings arguments through commandline
.NET Core Uninstall Tool
docs
code
General commands
add
new
publish
run
sln
test
Tools
docs.microsoft.com
docs.microsoft.com
docs.microsoft.com
docs.microsoft.com
docs.microsoft.com
docs.microsoft.com
docs.microsoft.com