Exercise – Create, build, and run your application
The .NET software development kit (SDK) includes a command-line interface (CLI) that can be accessed from Visual Studio Code’s integrated Terminal. During this training, you use .NET CLI commands to create new console applications, build your project code, and run your applications.
For example, the following .NET CLI command will create a new console application in the specified folder location:
.NET CLICopy
dotnet new console -o ./CsharpProjects/TestProject
The structure of a CLI command consists of the following three parts:
- The driver:
dotnet
in this example. - The command:
new console
in this example. - The command arguments:
-o ./CsharpProjects/TestProject
in this example.
Note
Command arguments are optional parameters that can be used to provide additional information. The previous command could be run without specifying the optional folder location. For example: dotnet new console
. In this case, the new console application would be created at the current folder location.
In this exercise, you use Visual Studio Code to create a new project folder, create a new console application using a CLI command, customize the application in the Visual Studio Code Editor, and then build and run your app.