I'm developing a desktop application in C# and Avalonia for my company. I have quite good experience with .NET development but I've never created an app for MacOS so I need some advises and best practices.
When I run the app on my Mac, it works properly, but I'm not able to run it on different device. The solutions contains multiple project and I compile it with this command:
dotnet publish \
-p:TargetFramework=net7.0 \
-p:RuntimeIdentifier=osx-arm64 \
-p:SelfContained=true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:PublishTrimmed=true \
-p:PublishReadyToRun=true \
-p:EnableCompressionInSingleFile=true \
-p:DebugType=embedded \
-p:ServerGarbageCollection=true \
--output dist
It creates folder with one executable and multiple .dylib
files. I'm not really sure how to create .app
bundle from this folder, I've found app called Platypus and it works quite well, but I will appreciate any advice on this.
In addition, the app needs folder with templates and config files (can be read-only) and creates quite high amount of temporary files which could use a temporary folder. Where should I put these? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
returns /Users/username/.config
, is it a good place for the temp folder?
Until now I've tried to put these things to the .app
bundle via Platypus, but after running it on another device, an unhandled exception occurred due to read-only permissions for the tmp folder created by the app. For testing purposes I'd tried to setup Run with root privileges
in Platypus and the exception didn't occur. But still, the main window of the app didn't show even when on my device it works well.
I will appreciate any ideas or advices on this issue. Also if there is any tutorial for beginner MacOS developers (I don't need to learn Swift right now), please let me know.