Commonly used Commands
Here are some of the commonly used commands for the dotnet
Creating a New ASP.NET Core project using dotnet CLI
Open the command prompt or Windows Powershell and create a Folder named “HelloWorld”
Dotnet new
dotnet new command is used to create the new project. The partial syntax is as follows
Where
TEMPLATE
The template to instantiate when the command is invoked
–force
Forces content to be generated even if it would change existing files. This is required when the output directory already contains a project.
-i|–install <PATH|NUGET_ID>
Installs a source or template pack from the PATH or NUGET_ID provided.
-l|–list
Lists templates containing the specified name. If invoked for the dotnet new command, it lists the possible templates available for the given directory. For example, if the directory already contains a project, it doesn’t list all project templates.
-lang|–language {C#|F#|VB}
The language of the template to create. The language accepted varies by the template (see defaults in the arguments section). Not valid for some templates.
-n|–name <OUTPUT_NAME>
The name for the created output. If no name is specified, the name of the current directory is used.
-o|–output <OUTPUT_DIRECTORY>
Location to place the generated output. The default is the current directory.
-h|–help
Prints out help for the command
The complete list of options for dotnet new is available here
Create a New Project using dotnet new
The following command creates a new dotnet project using the TEMPLATE
You can find out the list of template using
List of Templates
To create an empty web application use the template web
Restoring the Dependencies with dotnet restore
Once we created the new project, we have to download the dependencies. This is done using the restore command
use –help to get help
No comments:
Post a Comment