Skip to content

iOS: the Link metadata on automatically included items is incorrect #7692

@rolfbjarne

Description

@rolfbjarne

Description

The default item inclusion adds a Link metadata on the included items:

Link="%(RecursiveDir)%(FileName)%(Extension)"

Link="%(RecursiveDir)%(FileName)%(Extension)"

Link="%(RecursiveDir)%(FileName)%(Extension)"

The Link metadata specifies the path inside the app bundle for these items, with one caveat: if the value starts with IPhoneResourcePrefix:

<IPhoneResourcePrefix>$(iOSProjectFolder)Resources</IPhoneResourcePrefix>

then we strip that off the final location.

Example:

  • IPhoneResourcePrefix=Resources
  • There's a BundleResource resource with Link metadata Resources/myResource.txt
  • The final location in the app bundle would be MyApp.app/myResource.txt, because we removed IPhoneResourcePrefix from the start of the path.

In MAUI's case, this is what happens:

  • IPhoneResourcePrefix=Platform/iOS/Resources
  • There's a SceneTest.scn file in Platform/iOS/Resources/art.scnasset/SceneTest.scn
  • This file is automatically included using the glob $(iOSProjectFolder)**/*.scnassets/*, and the Link metadata is %(RecursiveDir)%(FileName)%(Extension) which resolves to Resources/art.scnasset/SceneTest.scn.
  • Notice how the Link metadata does not start with IPhoneResourcePrefix, which means the final location in the app bundle is MyApp.app/Resources/art.scnasset/SceneTest.scn, which is incorrect.

<SceneKitAsset
Include="$(iOSProjectFolder)**/*.scnassets/*"
Exclude="$(_SingleProjectiOSExcludes)"
Link="%(RecursiveDir)%(FileName)%(Extension)"
IsDefaultItem="true"
/>

Steps to Reproduce

Test project is available here: dotnet/macios#15104

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.4

Did you find any workaround?

Yes: dotnet/macios#15104 (comment)

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions