gpt4 book ai didi

windows - 如何使用 launch.json 定位平台

转载 作者:行者123 更新时间:2023-12-05 05:11:53 27 4
gpt4 key购买 nike

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 的作用是一样的)。

我针对 osxwindows 调整的 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",
"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}"
},
]
}

关于windows - 如何使用 launch.json 定位平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54982502/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com