VS code 中的 launch.json 文件屬性值 (.NET Core)

.NET Core 新建工程中自動生成的 launch.json 配置文件

{
   // 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/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "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/netcoreapp2.1/myapp.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
            "console": "internalConsole",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart"
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ,]
}

關於其中幾個字段的含義(摘自網絡)

console: 用於啓動程序的指定控制檯。默認爲 internalConsole

  1. internalConsole: VS Code Debug 控制檯 (輸入不被支持)
  2. integratedTerminal: VS Code 集成終端
  3. externalTerminal: 可以在用戶設置中配置的外部終端

stopOnEntry: 啓動後自動暫停程序

實際嘗試

"console": "internalConsole",

使用內置調試控制檯,默認設置,不過好像不支持輸入,可以改爲,

"externalTerminal"

使用外部控制檯,也就是CMD命令符窗口。

"integratedTerminal"

使用集成終端,也就是Windows PowerShell。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章