Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build VSCode development and debugging environment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Xiaobian to share with you how to build VSCode development debugging environment, I hope you have some gains after reading this article, let's discuss it together!

As VSCode continues to improve and grow, it's time to migrate some of your development to VS Code.

Currently using VS2019 to develop. NET Core applications, there has always been an idea to replicate the VS development environment in VS Code and migrate to VS Code.

So let's get started.

First, install the latest version of VS Code: https://code.visualstudio.com/. After installation, you may be prompted to upgrade. Upgrade is OK. After upgrading, version information:

Version: 1.40.1 (system setup)

Submitted by: 8795a9889db74563ddd43eb0a897a2384129a619

Date: 2019-11-13T16:49:35.976Z

Electron: 6.1.2Chrome: 76.0.3809.146Node.js: 12.4.0V8: 7.6.303.31-electron.0OS: Windows_NT x64 10.0.16299

The next steps are divided into several steps:

1. Install various powerful VSCode plugins

2. Creating. NET Core Solutions and Engineering

3. commissioning and operation

All right, let's get started.

Install various powerful VS Code plugins

1. C# extension for Visual Studio Code

The most important function of this plugin:

Lightweight development tools for .NET Core.

Great C# editing support, including Syntax Highlighting, IntelliSense, Go to Definition, Find All References, etc.

Debugging support for .NET Core (CoreCLR). NOTE: Mono debugging is not supported. Desktop CLR debugging has limited support.

Support for project.json and csproj projects on Windows, macOS and Linux.

2. C# Extensions

The most useful feature of this plugin is that you can right-click to create a new C#class and C#interface, and support various code snippets, such as ctor, prop, etc. For specific features, you can view the plugin description.

3. Auto-Using for C#

This plugin automatically adds using references.

4. vscode-solution-explorer

This plugin adds solution tab to VS Code, supports new solution, new project, add reference, Nuget package, this plugin is very useful

Adds a Solution Explorer panel where you can find a Visual Studio Solution File Explorer.

Can load any .sln version

Supports csproj, vcxproj, fsproj and vbproj (from vs2017 and before)

Supports dotnet core projects

You can create, delete, rename or move project folders and files.

You can create, delete, rename or move solution, solution folders and projects.

You can add or remove packages and references when the project is of kind CPS (dotnet core).

5. Code Runner (produced by Teacher Han Jun, must be a boutique)

Run code snippet or code file for multiple languages: C, C++, Java, JavaScript, PHP, Python, Perl, Perl 6, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F# Script, F# (.NET Core), C# Script, C# (.NET Core), VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml Script, R, AppleScript, Elixir, Visual Basic .NET, Clojure, Haxe, Objective-C, Rust, Racket, Scheme, AutoHotkey, AutoIt, Kotlin, Dart, Free Pascal, Haskell, Nim, D, Lisp, Kit, and custom command

That is, select a piece of code and run directly.

6. vscode-icons

With this plugin, give files and folders a more familiar icon

7. Visual Studio IntelliCode

VS code intelligent prompt, according to the context, automatically recommend the code you use next, AI-based background

8. NuGet Package Manager

Nuget package management, quick query to locate Nuget package, and install. However, I tried to customize Nuget source for an afternoon, but I didn't get it. I guess the URL is wrong.

9. Docker

10. Kubernetes

Others also need to configure GitHub, TFS similar source code management, TFS made two plug-ins, both do not work, after the subsequent update.

Creating. NET Core Solutions and Projects

At this point, the basic configuration of VS Code's environment is almost complete, and there are two modes next, creating solutions and projects.

1. via vscode-solution-explorer

The solution has a familiar feel.

We can continue to create projects: right-click sln, Add new project:

The project template will pop up. At this point, we select ASP.NET Core Web API Project.

Select C#

Then continue with the project name: for example TestWebApi

A familiar feeling came. You can start coding now.

The above is our new solution and project through vscode-solution-explorer. In the meantime, we can do it from the command line.

2. Via the Dotnet CLI command line

New sln:

dotnet

New ASP.NET Core WebAPI Project

dotnet "new" "webapi" "-lang" "C#" "-n" "TestWebApi" "-o" "TestWebApi"

Add TestWebApi project to solution EricTest

dotnet "sln" "e:\Work\ServiceDependency\EricTest.sln" "add" "e:\Work\ServiceDependency\TestWebApi\TestWebApi.csproj"

III. Commissioning and operation

Add debug configuration in Debug tab, focus on setting program to debug

After saving, start debugging:

Add breakpoints to the program, and then

Enter URL: https://localhost:5001/WeatherForecast

You can debug it.

After reading this article, I believe you have a certain understanding of "how to build a VSCode development and debugging environment." If you want to know more about this knowledge, please pay attention to the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report