dotnet cli Cheat Sheet by oba
dotnet commands for .NET Core 2.1
net csharp dotnet
dotnet newdotnet new sln
| Solution file | dotnet new console
| Console application | dotnet new classlib
| Class library | dotnet new mvc
| ASP.NET Core Web App (Model-View-Controller) | dotnet new xunit
| xUnit test project | dotnet new -l
| Obtain a list of the available templates |
dotnet slndotnet sln list
| List all projects in a solution file | dotnet sln todo.sln add todo-app/todo-app.csproj
| Add a C# project to a solution | dotnet sln todo.sln remove todo-app/todo-app.csproj
| Remove a C# project from a solution | dotnet sln todo.sln add **/*.csproj
| Add multiple C# projects to a solution using a globbing pattern |
dotnet adddotnet add package Newtonsoft.Json
| Add Newtonsoft.Json NuGet package to a project | dotnet add reference lib1/lib1.csproj lib2/lib2.csproj
| Add multiple project references to the project in the current directory | dotnet add app/app.csproj reference **/*.csproj
| Add multiple project references using a globbing pattern on Linux/Unix |
dotnet builddotnet build
| Build a project and all of its dependencies | dotnet build --configuration Release
| Build a project and its dependencies using Release configuration | dotnet build --runtime ubuntu.16.04-x64
| Build a project and its dependencies for a specific runtime (in this example, Ubuntu 16.04) |
Starting with .NET Core 2.0, you don't have to run dotnet restore because it's run implicitly. dotnet rundotnet run
| Run the project in the current directory | dotnet run --project ./projects/proj1/proj1.csproj
| Run the specified project | dotnet myapp.dll
| Run a framework-dependent app named myapp.dll |
| | dotnet cleandotnet clean
| Clean the output of a project | dotnet clean --configuration Release
| Clean a project built using the Release configuration |
Only the outputs created during the build are cleaned. Both intermediate (obj) and final output (bin) folders are cleaned.
dotnet publishdotnet publish
| Publish the project in the current directory | dotnet publish ~/projects/app1/app1.csproj
| Publish the application using the specified project file |
The dotnet publish command's output is ready for deployment to a hosting system (for example, a server, PC, Mac, laptop) for execution. dotnet efdotnet ef migrations add
| Add a new migration | dotnet ef migrations list
| List available migrations | dotnet ef migrations remove
| Remove the last migration | dotnet ef migrations script
| Generate a SQL script from migrations | dotnet ef database update
| Update the database to a specified migration | dotnet ef database drop
| Drop the database | dotnet ef dbcontext list
| List available DbContext types | dotnet ef dbcontext info
| Get information about a DbContext type | dotnet ef dbcontext scaffold
| Scaffolds a DbContext and entity types for a database |
dotnet packdotnet pack
| Build the project and create NuGet packages | dotnet pack --no-build --output nupkgs
| Pack the project in the current directory into the nupkgs folder and skip the build step | dotnet pack /p:PackageVersion=2.1.0
| Set the package version to 2.1.0 with the PackageVersion MSBuild property |
| | dotnet nugetdotnet nuget locals –l all
| Display the paths of all the local cache directories | dotnet nuget push foo.nupkg -k 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
| Push foo.nupkg to the default push source, specifying an API key | dotnet nuget delete Microsoft.AspNetCore.Mvc 1.0 --non-interactive
| Delete version 1.0 of package Microsoft.AspNetCore.Mvc, not prompting user for credentials or other input |
dotnet removedotnet remove package Newtonsoft.Json
| Remove Newtonsoft.Json NuGet package from a project in the current directory | dotnet remove reference lib/lib.csproj
| Remove a project reference from the current project | dotnet remove app/app.csproj reference **/*.csproj
| Remove multiple project references using a glob pattern on Unix/Linux |
etc.dotnet help
| Show more detailed documentation online for the command | dotnet migrate
| Migrate a Preview 2 .NET Core project to a .NET Core SDK 1.0 project | dotnet msbuild
| Provides access to a fully functional MSBuild | dotnet test
| Run the tests in the project in the current directory | dotnet list reference
| List the project references for the project in the current directory |
Environment variablesDOTNET_PACKAGES The primary package cache. | DOTNET_SERVICING Specifies the location of the servicing index to use by the shared host when loading the runtime. | DOTNET_CLI_TELEMETRY_OPTOUT Specifies whether data about the .NET Core tools usage is collected and sent to Microsoft. | DOTNET_MULTILEVEL_LOOKUP Specifies whether .NET Core runtime, shared framework, or SDK are resolved from the global location. | DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX Disables minor version roll forward. For more information, see Roll forward. |
|
Download the dotnet cli Cheat Sheet
2 Pages
http://www.cheatography.com/oba/cheat-sheets/dotnet-cli/
//media.cheatography.com/storage/thumb/oba_dotnet-cli.750.jpg
PDF (recommended)
Alternative Downloads
Your Download Will Begin Automatically in 5 Seconds.
Close
Cheatographer
en.otomatikmuhendis.com
Metadata
Favourited By
Comments
awesome
great
Keep trying to download this DOtNet CLI cheat sheet and it keeps cycling back to login/register even though I'm clearly registered. NOT IMPRESSED
Add a Comment
Related Cheat Sheets