Reputation: 381
I'm trying to figure out how to deploy a tool I made in C# + .NET core 3.1 to my coworkers as an easy-to-run .app file for Mac. The app is made, I've published it as a self-contained app so that they don't need to install .NET core, but I'm having problems getting the 120+ files into the single .app file.
I've tried doing this manually with an Info.plist but the app "crashes unexpectedly" when I try to run it as a .app (works fine when running just the executable).
Is there an easy way to do this straight from Visual Studio for Mac, or even from the commandline?
Here is my file structure for the manual attempt I made:
MyApp.app
Contents
Info.plist
MacOS
MyAppExecutable
(.net core files - DLLs, dylibs, etc)
Resources
icon.icms
Here is my Info.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>MyApp</string>
<key>CFBundleExecutable</key>
<string>MyAppExecutable</string>
<key>CFBundleIdentifier</key>
<string>com.Random-app-developer.www</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
</dict>
</plist>
Any idea how I can do this? Thank you
Upvotes: 0
Views: 2070
Reputation: 23298
.NET Core 3.x introduces a single file publish, which already allows you to produce a single binary. Basically, you can just add a PublishSingleFile>true</PublishSingleFile>
property to your .csproj
file or use -p:PublishSingleFile=true
with dotnet pusblish
CLI command.
Design document with some internal details can be found here
Upvotes: 2