Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for referencing zipped .xcframeworks in binding projects. #21294

Closed
LeadAssimilator opened this issue Sep 24, 2024 · 1 comment · Fixed by #21492
Closed

Add support for referencing zipped .xcframeworks in binding projects. #21294

LeadAssimilator opened this issue Sep 24, 2024 · 1 comment · Fixed by #21492
Assignees
Labels
binding-projects Issue or PR that affects binding projects enhancement The issue or pull request is an enhancement
Milestone

Comments

@LeadAssimilator
Copy link

Apple platform

iOS, macOS, Mac Catalyst, tvOS

Framework version

net8.0-*

Affected platform version

net8.0_17.5/17.5.8030

Description

It is currently impossible to reference a zipped xcframework from a binding project. Without this ability, one cannot use Visual Studio on Windows as part of their main development workflow with a paired Mac in various cases. While it is supposedly possible to reference zipped xcframeworks from non-binding projects, existing, larger and shared code bases cannot leverage that functionality as their bindings need the clear separation and reusability offered by binding projects.

The main well known limiting factors are due to Windows shortcomings regarding path length limits and symlink support. xcframeworks typically have long paths which run up against the limit and frequently exceed it. And dynamic xcframeworks that target maccatalyst have symlinks which get resolved to real files when they are copied, which breaks linking and/or signing. While both limitations could be overcome with special handling, the easiest solution is to support references to zipped xcframework so they can remain compressed on the Windows side of the build process. While this was done for non-binding projects, the same solution should be applied to binding projects as well.

Steps to Reproduce

  1. Create a binding project with a NativeReference to an xcframework.zip.
  2. Create a test application with a ProjectReference to the binding project
  3. Try to build the test app from VS on Windows
  4. Observe compilation errors
  5. Try to build the test app from cmdline on Mac
  6. Observe different compilation errors

Did you find any workaround?

  1. Make binding projects packable
  2. Set CompressBindingResourcePackage=true
  3. Pack the binding projects
  4. Copy to a local package source
  5. Configure projects to look at local package source
  6. Add package references to the binding project pacakges from the local package source

Build logs

No response

@LeadAssimilator LeadAssimilator added the binding-projects Issue or PR that affects binding projects label Sep 24, 2024
@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Sep 25, 2024
@rolfbjarne rolfbjarne added this to the .NET 10 milestone Sep 25, 2024
@rolfbjarne
Copy link
Member

rolfbjarne commented Oct 17, 2024

Test case for using NativeReference to a zipped xcframework in a normal project: f0aff1f

@rolfbjarne rolfbjarne self-assigned this Oct 22, 2024
rolfbjarne added a commit that referenced this issue Oct 22, 2024
…rojects and as NativeReference items. Fixes #21294.

Now it's possible to reference a compressed xcframework like this:

```xml
<NativeReference Include="path/to/myframework.xcframework.zip" />
```

This makes it easier to work with xcframeworks on Windows, because
xcframeworks can contain symlinks, and by zipping them up the whole symlink
problem is avoided.

Turns out there's already a NuGet that adds a .xcframework.zip file as a
NativeReference (Microsoft.ML.OnnxRuntime), so this makes that NuGet work.

Fixes #21294.
Fixes #21450.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding-projects Issue or PR that affects binding projects enhancement The issue or pull request is an enhancement
Projects
None yet
2 participants