Skip to content

[iOS] Cannot create archive due to the "Unzip" task failing with System.NotSupportedException because the app package content includes the link to local drive #22359

@Emtiaz-Tafsir

Description

@Emtiaz-Tafsir

Description

This is essentially a duplicate of #19916
Opening a separate issue since the issue is closed and the cause is different in my case (removing LaunchScreen.storyboard did not help)

Bug Description: The "Unzip" task fails during archive if there is a Resources folder with any images [may happen with other files too] within Platforms\iOS

If the above condition is met, the absolute path of the Platforms\iOS\Resources directory gets recreated inside the generated .app

Screenshot 2024-05-13 at 14 33 55

Because of this, the "Unzip" task fails and archiving remains incomplete.

Note that the path reference still gets created for normal Build/Rebuild operation as well, but it completes successfully and the ipa is also generated if BuildIpa is set to true. The problem appears only during the Publish operation.

The problem seems to occur just with the existence of such files even if the files are not referenced from .csproj.
Also it seems to not occur if the folder name is anything other than Resources.

Although the migration documentation states,

Resource files should typically be placed in the Resources folder of your .NET MAUI app project, or child folders of the Resources folder, and must have their build action set correctly.

The consequences of not doing is not mentioned.

Since I am porting a Xamarin app to MAUI, I wanted keep the project structure as unchanged as possible (The Xamarin app included a separate Resources folder for images referenced from platform specific code)

I have created a repro as well. Make sure to change the CodesignKey and CodesignProvision if you decide to use it.

Steps to Reproduce

  1. Create a Resources folder within Platform\iOS
  2. Place an image inside the folder
  3. Build/Rebuild should pass
  4. Publish should fail with System.NotSupportedException

Link to public reproduction project repository

https://github.com/Emtiaz-Tafsir/MauiRepro/tree/main/MauiArchiveFailureRepro

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

All

Did you find any workaround?

Restructure the project to include all the resources in the root Resources folder. Or refactor the folder name to something else

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-publishingIssues with the app packaging/publishing process (ipk/apk/msix/trimming)fixed-in-8.0.70fixed-in-9.0.0-preview.7.24407.4migration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/ioss/duplicate 2️⃣This issue or pull request already existss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    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