为mac创建一个自包含的可执行文件

Gue*_*lla 10 .net c# .net-core

我在Visual Studio中创建了一个.net核心控制台应用程序.我想现在打包它作为Windows和Mac的可执行文件.

我将运行时部分添加到project.json.

这是我的projects.json基于我在这里看到的:https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index#self-contained-application

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },

  "dependencies": {
    "AngleSharp": "0.9.9",
    "CsvHelper": "2.16.3",
    "Microsoft.NETCore.App": {
      "version": "1.0.1"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
    }
  },
  "runtimes": {
    "win10-x64": {},
    "osx.10.10-x64": {}
  }
}
Run Code Online (Sandbox Code Playgroud)

这会在调试/发布中创建一个win10-x64包含可执行文件但没有osx文件夹的文件夹.

我是否缺少针对此操作系统的依赖项?

Gue*_*lla 9

答案是从命令行发布它

dotnet publish -r osx.10.10-x64
Run Code Online (Sandbox Code Playgroud)

然后该文件夹/osx.10.10-x64/publish/包含一个文件,该文件可以在安装了SDK的mac上运行.