Reputation: 14926
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://learn.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?
Upvotes: 13
Views: 7464
Reputation: 2090
.NET Core does not build executables directly. Though that is in the roadmap, last I checked (1.0.1) it doesn't do that yet. You will get a DLL file on compile which you can run by passing it in to the dotnet binary. Don't let the DLL extension fool you, it works on any supported platform.
As the other guy said you should do a publish to ensure all your app files are copied to the publishing folder so they're ready to bundle up, but the same DLL file is just copied there. I've taken the same publish results and run them on both Windows under IIS and Red Hat under Kestrel.
Upvotes: -1
Reputation: 14926
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.
Upvotes: 10