如何使用 launch.json 定位平台
How to target platforms with launch.json
omnisharp ReadMe 是这样说的:
Operating System Specific Configurations
If there specific commands
that need to be changed per operating system, you can use the fields:
'windows', 'osx', or 'linux'. You can replace any of the fields
mentioned above for the specific operating system.
这是我的 launch.json
文件:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"args": [
"c:\git\core\XunitTestLib\Steps\",
// "~/../../XunitTestLib/Steps"
],
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
调试时我想在 Windows 上构建以从未注释的 "args"
条目开始,但是在 mac os 上我希望它从被注释掉的行。
我假设我会复制配置,一次用于 Windows 和 mac,但是这个陈述令人困惑:
You can replace any of the fields mentioned above for the specific operating system.
似乎是说我可以用 "osx"
替换 "args"
但这显然行不通。
如何为目标平台创建配置?
事实证明,针对多个平台比我预期的要容易得多,并且 explained here 关于 tasks.json
文件(但对 launch.json
的工作原理相同)。
我的 launch.json 文件针对 osx
和 windows
调整后如下所示:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"windows": {
"args": [
"c:\git\core\XunitTestLib\Steps\"
]
},
"osx": {
"args": [
"~/../../XunitTestLib/Steps"
]
},
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
omnisharp ReadMe 是这样说的:
Operating System Specific Configurations
If there specific commands that need to be changed per operating system, you can use the fields: 'windows', 'osx', or 'linux'. You can replace any of the fields mentioned above for the specific operating system.
这是我的 launch.json
文件:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"args": [
"c:\git\core\XunitTestLib\Steps\",
// "~/../../XunitTestLib/Steps"
],
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
调试时我想在 Windows 上构建以从未注释的 "args"
条目开始,但是在 mac os 上我希望它从被注释掉的行。
我假设我会复制配置,一次用于 Windows 和 mac,但是这个陈述令人困惑:
You can replace any of the fields mentioned above for the specific operating system.
似乎是说我可以用 "osx"
替换 "args"
但这显然行不通。
如何为目标平台创建配置?
事实证明,针对多个平台比我预期的要容易得多,并且 explained here 关于 tasks.json
文件(但对 launch.json
的工作原理相同)。
我的 launch.json 文件针对 osx
和 windows
调整后如下所示:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"windows": {
"args": [
"c:\git\core\XunitTestLib\Steps\"
]
},
"osx": {
"args": [
"~/../../XunitTestLib/Steps"
]
},
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}