10

我正在尝试在 OSX 上调试 dotnet 核心项目,并不断收到无法找到所需库的参考错误。

A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/Chris/Google Drive/Repos/project/src/project.api/bin/Debug/netcoreapp1.0'.
WARNING: The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use Microsoft.NETCore.App 1.0.0 or newer. This may be expected if the target process did not run .NET code.
The program '/Users/Chris/Google Drive/Repos/project/project.api/src/project.api/bin/Debug/netcoreapp1.0/project.api.dll' has exited with code 131 (0x00000083).

所以我查看了 bin 目录,发现 netcoreapp1.0 下还有一个名为 osx.10.11-x64 的附加目录。

在此处输入图像描述

在我的launch.json中,如果我手动将其添加到程序路径中,一切正常 - 我只是想知道这是否正常以及是否可以动态获取运行时,所以我不必为我工作的不同机器更改程序路径(windows、nix、osx)

这是launch.json的副本

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (web)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceRoot}/src/project.api/bin/Debug/netcoreapp1.0/osx.10.11-x64/project.api.dll",
            "args": [],
            "cwd": "${workspaceRoot}",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",
            "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}"
        }
    ]
}
4

0 回答 0