在 OSX 上安装 .NET Core Debugger 时出错

Error while installing .NET Core Debugger on OSX

我已经在 OSX El Capitan (10.11.4) 中安装了最新版本的 Visual Studio 代码 (1.1.1)。我还安装了最新版本的 Core RC2。 dotnet --version 给我 1.0.0-preview1-002702。我读到的网络线程之一说要删除旧版本的 OmniSharp 并安装最新版本,我做到了。我还通过 Brew 安装了 OpenSSL。

当我为 aspnet 安装最新的 yo 生成器并创建示例应用程序时,它 运行 没问题。当我尝试在 Visual Studio 代码中打开该文件夹时,我在输出 window:

中得到了这个

Downloading and configuring the .NET Core Debugger... Telemetry is: Enabled log : Restoring packages for /Users/rheckart/.vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/project.json... info : Committing restore... log : Lock file has not changed. Skipping lock file write. Path: /Users/rheckart/.vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/project.lock.json log : /Users/rheckart/.vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/project.json log : Restore completed in 632ms.

NuGet Config files used: /Users/rheckart/.vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/NuGet.config

Feeds used: https://www.myget.org/F/dotnet-core/api/v3/index.json https://api.nuget.org/v3/index.json https://www.myget.org/F/coreclr-debug/api/v3/index.json Telemetry is: Enabled Error: Can not find runtime target for framework 'DNXCore,Version=v5.0' compatible with one of the target runtimes: 'osx.10.11-x64'. Possible causes: 1. The project has not been restored or restore failed - run dotnet restore 2. The project does not list one of 'osx.10.11-x64' in the 'runtimes' section. Error:

System.InvalidOperationException: Can not find runtime target for framework 'DNXCore,Version=v5.0' compatible with one of the target runtimes: 'osx.10.11-x64'. Possible causes: 1. The project has not been restored or restore failed - run dotnet restore 2. The project does not list one of 'osx.10.11-x64' in the 'runtimes' section. at Microsoft.DotNet.ProjectModel.BuildWorkspace.GetRuntimeContext(ProjectContext context, IEnumerable1 runtimeIdentifiers) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Microsoft.DotNet.Tools.Publish.PublishCommand.TryPrepareForPublish()
at Microsoft.DotNet.Tools.Publish.PublishCommand.<>c__DisplayClass0_0.b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.DotNet.Tools.Publish.PublishCommand.Run(String[] args) dotnet exited with error code 1 Error while installing .NET Core Debugger.

我尝试执行第 1 步和第 2 步,但仍然出现相同的错误。我的 project.json 文件如下所示:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },

  "tooling": {
    "defaultNamespace": "rc2api"
  },
  "runtimes": {
      "osx.10.11-x64": { }
    }
}

如果我尝试 运行 使用 .NET Core Launch (web) 在 VS Code 中进行调试,我收到一个错误:

Debug adapter executable '/Users/rheckart/.vscode/extensions/ms-vscode.csharp-0.3.7/coreclr-debug/debugAdapters/OpenDebugAD7' not found.

关于为什么这不起作用的任何想法?

我收到了同样的错误。对我来说,我注意到 VS Code C# 扩展有可用的更新(我在左下角的图标上看到了绿色圆圈)。安装更新(版本 1.0.10)并重新启动 VS Code 后,错误消失了,我得到 "Successfully installed .NET Core Debugger".

我设法通过删除较旧的 .NET Core 版本并安装最新版本来解决此问题。由于旧版本不支持命令行选项,安装似乎失败了。

可以在这里找到卸载脚本和最新的安装包(步骤 1 和 2):https://www.microsoft.com/net/core#macosx