uno icon indicating copy to clipboard operation
uno copied to clipboard

Desktop TFM Packaging Support

Open jeromelaban opened this issue 10 months ago • 13 comments

What would you like to be added

Add support for publishing to different platform specific packages:

  • [ ] #17427
  • [ ] unoplatform/uno.resizetizer#308
  • [x] #17883
  • [ ] #17879
  • [x] #17877
  • [ ] #17878
  • [x] unoplatform/uno.resizetizer#301
  • [ ] #17428
  • [ ] #17881
  • [ ] #17042
  • [ ] #17141
  • [ ] #17884
  • [ ] #17885
  • [ ] #17886
  • [ ] #17137

known issues

  • [ ] #17809

Why is this needed

No response

For which platform

No response

Anything else we need to know?

No response

Additional resources

  • Appimage example is available in calculator: https://github.com/unoplatform/calculator/tree/uno/build/appimage
  • Snap example is available in calculator: https://github.com/unoplatform/calculator/tree/uno/build/snap
  • macOS can be done using https://github.com/egramtel/dotnet-bundle

jeromelaban avatar Apr 24 '24 13:04 jeromelaban

I would also suggest packaging for Flatpak. AppImages are pretty much on life support, so I'm not sure if it's worth the effort.

ramezgerges avatar Apr 26 '24 09:04 ramezgerges

If anyone is tracking this issue, I've added some links to known macOS and Linux packaging samples in the original post.

jeromelaban avatar May 09 '24 13:05 jeromelaban

If anyone is tracking this issue, I've added some links to known macOS and Linux packaging samples in the original post.

This is not working for my app. I've added the Dotnet.Bundle-Nuget to my Uno-Project (single project, Uno 5.2). Then I tried building it with this command: dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=net8.0-desktop

It states The target BundleApp does not exist in the project. According to this issue I also tried adding a TargetFramework-Parameter: dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=net8.0-desktop -p:TargetFramework=net8.0 This leads to the same error. Any hints?

TopperDEL avatar May 13 '24 12:05 TopperDEL

@TopperDEL I had the same error as you.

I was able to make the command line ran successfully:

  • I fixed the RuntimeIdentififer to osx-arm64
  • Added CFBundleShortVersionString
  • Added restore

dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-arm64 -p:TargetFramework=net8.0-desktop /p:CFBundleShortVersionString=1.0.0 -restore

Please let me know if it works. I have the publish folder, but I don't know what else to do with it.

ArchieCoder avatar May 22 '24 12:05 ArchieCoder

Hm, I get the error C:\Program Files\dotnet\sdk\8.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: Der Zielplattformbezeichner "desktop" wurde nicht erkannt. (TargetFramework-name "desktop" not recognized) for all of my library projects.

TopperDEL avatar May 22 '24 13:05 TopperDEL

@jeromelaban May you clarifiy how bundeling for macOs could work? I would love to get a *.pkg for the net8.0-desktop targeting macOS.

TopperDEL avatar May 22 '24 13:05 TopperDEL

@TopperDEL did you use the same line as me?

ArchieCoder avatar May 22 '24 13:05 ArchieCoder

Exactly the same, yes. But I have a quite huge solution already with many library-projects. May you add one library to your project and see if that works? This is a sample of a library that crashed with the above "desktop not recognized"-error:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MvvmGen"/>
    <PackageReference Include="SharpHash"/>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\myapp.Contracts\myapp.Contracts.csproj" />
    <ProjectReference Include="..\myapp.Services\myapp.Services.csproj" />
  </ItemGroup>
</Project>

TopperDEL avatar May 22 '24 13:05 TopperDEL

Hm, I get the error C:\Program Files\dotnet\sdk\8.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: Der Zielplattformbezeichner "desktop" wurde nicht erkannt. (TargetFramework-name "desktop" not recognized) for all of my library projects.

This generally means that the Sdk specified at the root of the csprojs is not Uno.Sdk.

@jeromelaban May you clarifiy how bundeling for macOs could work? I would love to get a *.pkg for the net8.0-desktop targeting macOS.

It's not defined at this point, but intuitively, dotnet publish would generate a .pkg or a .app.

jeromelaban avatar May 22 '24 14:05 jeromelaban

Hm, I get the error C:\Program Files\dotnet\sdk\8.0.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: Der Zielplattformbezeichner "desktop" wurde nicht erkannt. (TargetFramework-name "desktop" not recognized) for all of my library projects.

This generally means that the Sdk specified at the root of the csprojs is not Uno.Sdk.

Are class libraries meant to also use Uno.Sdk?

@jeromelaban May you clarifiy how bundeling for macOs could work? I would love to get a *.pkg for the net8.0-desktop targeting macOS.

It's not defined at this point, but intuitively, dotnet publish would generate a .pkg or a .app.

Who is in charge to define this? Is this a Microsoft-thing?

TopperDEL avatar May 23 '24 06:05 TopperDEL

Are class libraries meant to also use Uno.Sdk?

If you want to use Uno in this class library, yes.

Who is in charge to define this? Is this a Microsoft-thing?

It will be an Uno Platform feature.

jeromelaban avatar May 23 '24 11:05 jeromelaban

So a "normal" class-library (containing only C#-code) does not need to Reference the Uno.Sdk. Hm. Still wondering where this error comes from then.

I'm looking forward to have the PKG/APP-support. Thanks for your awesome work!

TopperDEL avatar May 23 '24 11:05 TopperDEL

So a "normal" class-library (containing only C#-code) does not need to Reference the Uno.Sdk. Hm. Still wondering where this error comes from then.

Normal class libraries should not be showing this error. If you can repro that specific behavior, please open an issue with more details. Thanks!

jeromelaban avatar May 23 '24 11:05 jeromelaban