-
Notifications
You must be signed in to change notification settings - Fork 514
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
Automatically include .framework or .a files in the NuGet's runtimes/ios/native folder #11667
Comments
What do we do if the NuGet includes (or want to include) a static library as well? In your example the NuGet would ship both of these:
We must only include one of them in the .app. |
In theory there should be
That's generally handled with Also that one should not be included in the app bundle but as part of the build. Apple is known to reject them (iirc it depends on where they are located in the bundle). Incidentally that only makes it harder to detect if both are present - and we can't trust names as you'll often see
This will likely ends up as a GIGO. We can make a best effort [1] to catch incorrect input but the output validations [2] is out of our hands (not fully documented and changes over time). [1] like warn about |
If they include both, then that is up to the library author. If I want to do something fancy, then I need to go back to putting it say in the build folder and use the targets file. Just like if I want to put a bunch of files in the native folder for windows - all the dlls will get copied to the output. If I want to have a proper system, then I would write a targets file to pick one or something. |
Yeah but the reality (what we see today with many nuget) is that many authors don't have (full time) access to Mac, nor automated tests on Mac/devices. Many things can work fine for the simulator (e.g. bundling a static library) but that won't work for device (or be submittable to Apple). That can be very frustrating as the customer (of that nuget) might only find out very late in his app development cycle (like at submit time) that he needs to file an issue with the nuget author (and yes, we're often in the middle of that). For other (but similar) reasons I've been thinking of a nuget validation tool/script that would build sim and device apps and check that they build, start (sim or device) and pass a few checks (build time) we know Apple also do. Don't hold your breath as I've been thinking of something similar for 3rd party bindings since I started introspection tests (circa 2012). |
Well a static lib should be linked in directly? Not actually included as a bundle item, right? I would put it there and then the SDK would convert it into a implicit If I want to control where this runs, then I would put this in say |
That was (re-using) the example :) Still you can run into projects that ships both Or, like the original, how do you pick the I'm not against the idea of having automatic inclusions :) but it's not as trivial as other platforms (more choices) and the knowledge of what/when/why to use one, over others, is less common.
Guess how we discovered Apple would refuse such bundles ;-) |
One thing that I will say is that the folder is designed for this auto-inclusion. If you don't want it to be included, then you shouldn't use this folder. Just like with putting things in the lib folder - it is auto included in the build. If you want to exclude some dlls, then you put it somewhere else. |
@mattleibow do you have a test project for this? Or could you create one? |
I believe this to be the same as #12572 (which is a more general issue), so I'm closing this one in favor of that one. |
Steps to Reproduce
I see the PR that brings native bits into apps was merged: #11593. This fixes the ability to use native libs, but since all the other platforms automatically include the files under runtimes, this is a bit unexpected. (#11593)
There is the case where files may get greedily included by the build system, but this is not a big issue because the
<PackageReference>
element has theExcludeAssets
andIncludeAssets
attribute that can be used to control this. (https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets)Expected Behavior
The native framework /runtimes/ios/native/libSkiaSharp.framework is automatically included into the app.
Actual Behavior
The native framework was not included.
Environment
Build Logs
Example Project (If Possible)
The text was updated successfully, but these errors were encountered: