Avalonia发布MacOS运行程序

1 打开xxx.csproj项目文件,添加Dotnet.Bundle包;

<PackageReference Include="Dotnet.Bundle" Version="*" />

2 在xxx.csproj中添加配置;

<CFBundleName>xxx</CFBundleName> <!-- Also defines .app file name -->
    <CFBundleDisplayName>xxx</CFBundleDisplayName>
    <CFBundleIdentifier>com.laiger.ios</CFBundleIdentifier>
    <CFBundleVersion>1.0.0</CFBundleVersion>
    <CFBundlePackageType>AAPL</CFBundlePackageType>
    <CFBundleSignature>????</CFBundleSignature>
    <CFBundleExecutable>xxx</CFBundleExecutable>
    <CFBundleIconFile>xxx.icns</CFBundleIconFile> <!-- Will be copied from output directory -->
    <CFBundleShortVersionString>1.0</CFBundleShortVersionString>
    <NSPrincipalClass>NSApplication</NSPrincipalClass>
    <NSHighResolutionCapable>true</NSHighResolutionCapable>

3 执行发部命令;

dotnet restore -r osx-x64

dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64  -property:Configuration=Release

4 将xxx.app文件拷贝到MacOs电脑上,并执行授权命令;

chmod +x xxx.app/Contents/MacOS/TestApp 

 引用:Mac OS 部署Avalonia+.Net Core项目 - 灰信网(软件开发博客聚合) (freesion.com)

posted @ 2022-12-05 15:40  趋时软件  阅读(484)  评论(0编辑  收藏  举报