Visual Studio 在 OSX 上调试 c# 脚本,显示错误: preLaunchTask“构建”以退出代码 1 终止。
这是 launch.json 文件的副本:
{
"version": "0.2.0",
"configurations": [{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/hwapp.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"externalConsole": false
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/hwapp.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
这是 tasks.json 文件的副本:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [ ],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
}
]
}
我该如何解决这个问题???PLS
最佳答案
如果您使用的是 MacPorts,那么这可能是您的问题,(这是给我的)。
我在我的 .zshrc
或 .profile
等中有这个链接到 OpenSSL 的 MacPorts 版本:
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:~/lib:/usr/local/lib:/lib:/usr/lib
.NET Core 从这里开始工作。
既不是 VSCode 也不是 Rider尽管 (我得到了你遇到的错误) 将进行调试。
我的问题是 OmniSharp , 这是 link到引发错误的文件。您可以通过在 VSCode 的命令面板中输入 Debug: Download .NET Core Debugger
来验证安装是否失败:
为了解决这个问题,我为 OpenSSL 创建了 2 个符号链接(symbolic link)(不是很优雅,但是......):
(您可能不再需要使用这些符号链接(symbolic link)进行上述导出)
% sudo ln -s /opt/local/lib/libcrypto.1.0.0.dylib /usr/local/lib/
% sudo ln -s /opt/local/lib/libssl.1.0.0.dylib /usr/local/lib/
然后我重新安装了VSCode的C#插件,并在命令托盘中重新执行了Debug: Download .NET Core Debugger
。我现在可以在 VSCode 和 Rider 中进行调试。
*如果这对您不起作用,您可能会从上述 VSCode 命令中获得一些有用的输出/信息。
关于c# - 错误 :The preLaunchTask 'build' terminated with exit code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41066050/