dotnet command and its use
The .NET Core command-line interface (CLI) is a new cross-platform tool for creating, restoring packages, building, running and publishing .NET applications.
Visual Studio uses this CLI internally to restore, build, and publish your application. Other high-level IDEs, editors, and tools can use the CLI to support .NET Core applications.
All the command prefix or start with "dotnet".
1. new - Creates a new project, configuration file, or solution based on the specified template
Parameter
[-n] -- Project name
[-o] -- Output directiry
[-d] -- diagnostics
syntax - dotnet new console -o MyProjectName
2. restore - to restore dependencies as well as project-specific tools that are specified in the project file.
syntax - dotnet restore ./projects/MyProjectName/app1.csproj
3. Build - builds the project
syntax- dotnet build
4. Run - Runs source code without any explicit compile or launch commands.
syntax - dotnet run
5. Publish - packages the application for deployment.
syntax - dotnet publish -o path
6. add package - provides a convenient option to add or update a package reference in a project file.
syntax - dotnet add package <PACKAGE_NAME>
example -dotnet add package Microsoft.EntityFrameworkCore
7. tool install- installs a .NET tool globally or local
syntax
local
dotnet tool install <PACKAGE_NAME> [--local]
global
dotnet tool install <PACKAGE_NAME> -g
0 Comments
thank you for your comment