添加注释:我使用 NET 8 版本为您创建了文件(如果还没有的话),在根目录中创建一个目录.vscode,并在其中放置两个文件。将相应的替换为您的项目名称<PROJECT>
.vscode/launch.json
{"version":"0.2.0","configurations":[{// Use IntelliSense to find out which attributes exist for C# debugging// Use hover for the description of the existing attributes// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md"name":".NET Core Launch (console)","type":"coreclr","request":"launch","preLaunchTask":"build",// If you have changed target frameworks, make sure to update the program path."program":"${workspaceFolder}/bin/Debug/net8.0/<PROJECT>.dll","args":[],"cwd":"${workspaceFolder}",// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console"console":"integratedTerminal","stopAtEntry":false},{"name":".NET Core Attach","type":"coreclr","request":"attach"}]}
添加注释:我使用 NET 8 版本为您创建了文件(如果还没有的话),在根目录中创建一个目录
.vscode
,并在其中放置两个文件。将相应的替换为您的项目名称<PROJECT>
.vscode/launch.json
.vscode/tasks.json
PS:我必须创建一个新项目,并根据文档首先尝试所有内容。它应该可以工作,或者您的扩展有问题,也许它们发生冲突。这大概就是结果,所有这些都是通过
F5
该部分的按键或按钮启动的Run And Debug
。PS:随心所欲地更改任务并查看控制台 - 你应该在书中看到所有这些论点
dotnet run --project ...