Here is a comprehensive .NET CLI cheat sheet formatted cleanly in Markdown. If you are just getting started, you might want to learn how to install the .NET SDK first, or explore how to use .NET CLI in CI/CD pipelines to automate your builds. .NET CLI Cheat Sheet ℹ️ Environment & Diagnostics
| Command | Description |
|---|---|
| — | Display the active .NET SDK version. |
| — | Display detailed environment information (OS, architecture, runtimes). |
| — | List all installed .NET SDK versions. |
| — | List all installed .NET runtime environments. |
📁 Solution Management
| Command | Description |
|---|---|
| — | Create a new blank solution file. |
| — | Add an existing project to a solution file. |
| — | Remove a project from a solution file. |
| — | List all projects referenced inside a solution file. |
🏗️ Project Creation
| Command | Description |
|---|---|
| — | List all installed templates (console, webapi, blazor, etc.). |
| — | Search NuGet for templates matching the term. |
| — | Create a new C# Console application in a subfolder. |
| — | Create a new C# ASP.NET Core Web API project. |
| — | Create a new C# Class Library project. |
📦 Dependency & Package Management
| Command | Description |
|---|---|
| — | Add a NuGet package reference to the project. |
| — | Add a specific version of a NuGet package. |
| — | Remove a NuGet package from the project. |
| — | Add a project-to-project reference. |
| — | Remove a project-to-project reference. |
| — | Restore dependencies and tools configured in the project. |
⚙️ Development, Build & Deployment
| Command | Description |
|---|---|
| — | Compile the project or solution in Debug mode. |
| — | Compile using the Release configuration. |
| — | Build and immediately execute the app (from the project directory). |
| — | Run a specific project from an external directory. |
| — | Run the application with "Hot Reload" enabled (auto-rebuilds on file change). |
| — | Delete build artifacts ( and folder contents). |
| — | Run unit tests associated with the current project/solution. |
| — | Compile and package files to a target folder for deployment. |
🛠️ Global & Local Tools
| Command | Description |
|---|---|
| — | Install a .NET tool globally on your system. |
| — | Update a specific global tool to its newest version. |
| — | List all globally installed .NET tools. |
| — | Uninstall a specific global tool. |
💡 Pro-Tips
• Pass arguments to your app: When using , pass arguments to your app by placing them after double dashes: . • Global configuration: Pin your project to an exact .NET SDK version using a file in your root folder. [1, 2, 3]
If you plan on expanding this reference later, I can also show you how to include Entity Framework Core (EF Core) CLI tools or how to configure MSBuild switches via CLI.
AI responses may include mistakes.
[1] https://platform.uno/blog/net-native-apps-cli-cheatsheet/ [2] https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-run [3] https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-run