Visual Studio作为宇宙第一的IDE,开发调试.net core app,无一能出其右,我们还需要去了解Visual Studio Code吗?答案是肯定。
那么Visual Studio Code的小而美的优势就会体现出来。
纯属混字数的,扔一个链接https://code.visualstudio.com/,下载去吧,
同样是扔一个链接https://dotnet.microsoft.com/download,页面选项卡,有4种环境
按需选择吧
略过
假设你已经编码完成,
F5开始调试->Select Envoriment->.net core
然后就会创建.vscode文件夹,且创建了launch.json
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
      
    {
      "name": ".NET Core Launch (web)",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build",
      "program": "${workspaceFolder}/Vmware.Sphere.Api/bin/Debug/netcoreapp3.1/properties/netcoreapp3.1/Vmware.Sphere.Api.dll",
      "args": [],
      "cwd": "${workspaceFolder}/Vmware.Sphere.Api",
      "stopAtEntry": false,
      "serverReadyAction": {
        "action": "openExternally",
        "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
      },
      "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "sourceFileMap": {
        "/Views": "${workspaceFolder}/Views"
      }
    },
    {
      "name": ".NET Core Attach",
      "type": "coreclr",
      "request": "attach",
      "processId": "${command:pickProcess}"
    }
  ]
}
其他属性,还想知道具体作用,鼠标悬停在launch.json的某一个属性上,就可以了解,并根据实际情况进行修改。
F5->Could not find the task 'build'->Configure Task->Select a task to configure->Create task.json file from temple->.Net Core
就会继续在.vscode下创建task.json
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "shell",
            "args": [
                "build",
                // Ask dotnet build to generate full paths for file names.
                "/property:GenerateFullPaths=true",
                // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]
}
preLaunchTask:"build",Task to run before debug session starts.在启动调试会话之前运行的任务,说白了,就是调试之前,总得构建生成吧。然后就会触发task中lable名为build的构建任务现在就可以正常调试了
https://code.visualstudio.com/docs/editor/debugging#_launch-configurations