Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a self contained executable for mac

Tags:

c#

.net

.net-core

I have made a .net core console app in Visual Studio. I want to package it now as an executable for both windows & mac.

I added the runtime section to project.json.

This is my projects.json based on what I saw here: 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": {}
  }
}

This creates a folder in debug/release called win10-x64 that includes an executable but there is no folder for osx.

Am I missing a dependency to target this OS?

like image 224
Guerrilla Avatar asked Dec 14 '16 13:12

Guerrilla


1 Answers

The answer was to publish it from the command line

dotnet publish -r osx.10.10-x64

Then the folder /osx.10.10-x64/publish/ holds a file that can be run on a mac that has the SDK installed.

like image 80
Guerrilla Avatar answered Oct 04 '22 04:10

Guerrilla