I have an application in .NET Core 3.1.200 with this PublishProfile for targeting osx-x64:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>False</PublishTrimmed>
</PropertyGroup>
</Project>
I've run dotnet publish myapp.cproj /p:PublishProfile=profile.xml
and at the end the /publish folder contains a single file "myapp" (this is correct since PublishSingleFile=True).
But it has no extension. How do I run it on MacOS?
EDIT: I've discovered I can simply run it from Terminal with ./myapp
. But how to run it by double-clicking on Finder? For now, it shows:
.NET Core based applications (with user interface) must be packaged up as application bundle, so as to be recognized by Finder properly.
It is a lengthy process, but Avalonia guys wrote an article with detailed steps,
https://docs.avaloniaui.net/docs/distribution-publishing/macos
You can use dotnet-bundle
tool to automate most of them.