.NET Core launch.json 簡介

1.環境 Windows,.NET Core 2.0,VS Codegit

dotnet> dotnet new console -o myAppgithub

2.launch.json配置文件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}/myApp/bin/Debug/netcoreapp2.0/myApp.dll",
            "args": [],
            "cwd": "${workspaceFolder}/myApp",
            // 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}"
        }
    ,]
}

在launch.json中app

name:配置名稱,在啓動配置下拉菜單中顯示
type:配置類型
request:請求配置類型(通常爲launch或attach)運行或附加
preLaunchTask:調試會話前要運行的任務
program:程序Build之後生成的dll,默認是${workspaceFolder}/bin/Debug/(target-framework)/(project-name.dll)
workspaceFolder:正在調試的程序的工做目錄的路徑。默認爲當前工做區(即便用Code命令進入的目錄)
target-framework:框架
args:傳遞給程序的命令行參數
cwd:項目目錄
console:啓動調試目標的位置
stopAtEntry:調試器是否在目標的入口點中止,默認爲 false
internalConsoleOptions:內部調試控制檯的控制行爲
processId:要附加到的進程 id。使用  "$ {command:pickProcess}" 以獲取要附加到的正在運行的進程的列表。若是使用 "processId", 則不該使用 "processName"。
注:在.NET Core 1.0版本中
externalConsole:Console單獨啓動配置,開發console時,若是須要輸入後調試,將值設置爲true,將console單獨啓動便可。
相關文章
相關標籤/搜索