Build a .NET development environment on Windows
This topic describes how to develop a .NET project by using Visual Studio Code (VS Code) on Windows.
Step 1: Install VS Code
-
Visit the official website of VS Code and click Download for Windows to download the installation file.
-
Double-click the downloaded file such as VSCodeUserSetup-x64-1.89.1.exe and use the installation wizard to install VS Code.
ImportantIn the Select Additional Tasks step, you must select Add to PATH (requires shell restart).
Step 2: Create a. NET project
Open VS Code, and click Extensions in the left-side navigation pane or press
Ctrl+Shift+X. In the EXTENSIONS panel, search for and install the following plug-ins:C#: provides features such as IntelliSense, code navigation, debugging, code formatting, and refactoring. You can use the C# plug-in to manage .NET projects and NuGet packages. The C# plug-in seamlessly integrates .NET development processes and is a necessary tool for C# developers to improve coding efficiency.
.NET Install Tool: allows you to configure the C# development environment with ease and run the
dotnetcommand to create, run, and build .NET core projects in VS Code. This simplifies the development process and improves the development efficiency.
-
Create a console application: Select File > Open Folder to open a folder for your project. In the terminal, run the
dotnet new console -n FirstDotnetProjectcommand to create a new console application.PS D:\ide\dotnetprojects> dotnet new console -n FirstDotnetProject The template "Console App" was created successfully. Processing post-creation actions... Restoring D:\ide\dotnetprojects\FirstDotnetProject\FirstDotnetProject.csproj: Determining projects to restore... Restored D:\ide\dotnetprojects\FirstDotnetProject\FirstDotnetProject.csproj (in 68 ms). Restore succeeded. PS D:\ide\dotnetprojects> -
Run the project in the
FirstDotnetProjectfolder and run thedotnet runcommand in VS Code. IfHello, World!is returned, the environment is built.
Step 3: Install dependencies
You can run the dotnet add package <package-name> command to install dependencies. For example, you can run the following command to install the ECS SDK dependency:
dotnet add package AlibabaCloud.SDK.Ecs20140526