


Let's talk about how to configure the .NET environment in VSCode and develop and debug .NET 5
How to configure .NET environment in VSCode? The following article will introduce to you how to use VSCode to develop and debug .NET 5 from scratch. I hope it will be helpful to you!
Develop and debug .NET 5 from scratch using VS Code. You can develop and debug .NET 5 applications without installing VS 2019.
VS Code’s full name is Visual Studio Code. Visual Studio Code is a lightweight cross-platform web integrated development environment that can run under Linux, Mac and Windows!
This article is a tutorial on developing and debugging .NET 5 with VS Code. The actual operation is done under Windows, but it is also applicable to other systems. [Recommended learning: "vscode introductory tutorial"]
Environment installation
This article demonstrates the development environment: WIN10 x64 Visual Studio Code 1.55.1
. NET 5.0 SDK Windows x64 Installer:
https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.202-windows-x64-installer
More System version download: https://dotnet.microsoft.com/download
VSCode:
https://code.visualstudio.com/
VSCode C# plug-in:
Open the extension and search for C#, select C# to install.
Restart VS Code after installing the plug-in.
Create project
First make sure the .NET Core SDK is installed successfully.
dotnet --version
The output is as follows:
5.0.202
Then you can create the project.
dotnet new console -o myapp cd myapp dotnet run
After the entire command is executed, the project is created. dotnet new will execute dotnet restore by default, you only need dotnet run.
Use VS Code to develop
Use VS Code to open the myapp folder and open the Program.cs file
If you open it for the first time, you need to wait patiently for the plug-in to be installed. The installation is successful as shown below:
Then wait for a while, as shown in the picture above, the prompt Required assets to build and debug are missing from 'myapp'. Add them?, Just select Yes.
The plug-in will automatically generate the .vscode folder and configure launch.json for us.
Use VS Code to debug
Next switch to the debugging window to debug, click the debug button
The breakpoint is successfully broken.
F10 Single-step skip F11 Single-step debugging F5 execution.
You can also choose additional debugging, as follows:
Add the code to Console.ReadKey();
Then execute it in the terminaldotnet .\bin\Debug\net5.0\myapp.dll
Then in During debugging, switch to .NET Core Attach Click the debug button, select dotnet.exe
Insert a breakpoint in VS Code, and then enter any key in the terminal You can continue, and the program can reach the debugging state normally.
It is very convenient to write code, and the C# plug-in provides intelligent prompt function for development. This way you can develop .NET 5 without installing VS 2019.
VS Code plug-in
Appearance plug-in
Theme plug-inGitHub Theme
More Multiple themes can be searched for Theme
Icon icon plug-in: vscode-icons
Development plug-in
Visual Studio IntelliCode coding smart prompt
REST Client interface request artifact
Example:
POST https://example.com/comments HTTP/1.1 content-type: application/json { "name": "sample linezero", "time": "Wed, 21 Oct 2020 18:27:50 GMT" }
Thunder Client requests the interface like PostMan
vscode-solution-explorer Operate the project like VS
##ASP.NET Core 3.1 New Book Release " A practical introduction to ASP.NET Core project development"Jingdong: https://item.jd.com/12961032.htmlDangdang: http://product.dangdang.com/29122210. html
For more knowledge about VSCode, please visit: vscode tutorial! !
The above is the detailed content of Let's talk about how to configure the .NET environment in VSCode and develop and debug .NET 5. For more information, please follow other related articles on the PHP Chinese website!

VisualStudio is suitable for large-scale projects and enterprise-level application development, while VSCode is suitable for rapid development and multilingual support. 1. VisualStudio provides a comprehensive IDE environment and supports Microsoft technology stack. 2.VSCode is a lightweight editor that emphasizes flexibility and scalability, and supports cross-platform.

Yes, some versions of VisualStudio are free. Specifically, VisualStudioCommunityEdition is free for individual developers, open source projects, academic research, and small organizations. However, there are also paid versions such as VisualStudioProfessional and Enterprise, suitable for large teams and enterprises, providing additional features.

Cross-platform development with VisualStudio is feasible, and by supporting frameworks like .NETCore and Xamarin, developers can write code at once and run on multiple operating systems. 1) Create .NETCore projects and use their cross-platform capabilities, 2) Use Xamarin for mobile application development, 3) Use asynchronous programming and code reuse to optimize performance to ensure efficient operation and maintainability of applications.

The ways to format JSON in VS Code are: 1. Use shortcut keys (Windows/Linux: Ctrl Shift I; macOS: Cmd Shift I); 2. Go through the menu ("Edit" > "Format Document"); 3. Install JSON formatter extensions (such as Prettier); 4. Format manually (use shortcut keys to indent/extract blocks or add braces and semicolons); 5. Use external tools (such as JSONLint and JSON Formatter).

Compiling code in VSCode is divided into 5 steps: Install the C extension; create the "main.cpp" file in the project folder; configure the compiler (such as MinGW); compile the code with the shortcut key ("Ctrl Shift B") or the "Build" button; run the compiled program with the shortcut key ("F5") or the "Run" button.

To install Visual Studio Code, please follow the following steps: Visit the official website https://code.visualstudio.com/; download the installer according to the operating system; run the installer; accept the license agreement and select the installation path; VSCode will start automatically after the installation is completed.

The methods to enlarge fonts in Visual Studio Code are: open the settings panel (Ctrl, or Cmd,). Search and adjust "Font Size". Choose "Font Family" with the right size. Install or select a theme that provides the right size. Use keyboard shortcuts (Ctrl or Cmd) to enlarge the font.

How to connect to a remote server through VSCode? Install Remote - SSH Extended Configuration SSH Create a Connection in VSCode Enter connection information: Host, Username, Port, SSH Key Double-click the saved connection in Remote Explorer


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use