3

I am trying to build a new IOS release and get the following error:

"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.After.targets(80,3): error : There was an error unzipping the file bin\iPhone\AppStore\AppBundle\MyApp.zip: Extracting Zip entry would have resulted in a file outside the specified destination directory."

The output line that generates this error is:-

"/usr/bin/zip -r /Users/fred/Library/Caches/Xamarin/mtbs/builds/MyApp/ca830d1e9af62a1e18d114cf402fd82be9cb814135209657390ffb486f0d0ee4/bin/iPhone/AppStore/AppBundle/MyApp.zip ../MyApp.app" 

It appears that rather than going back to the parent directory and then zipping the "MyApp.app" directory, the process is creating a zip file with ".." as the root directory with "MyApp.app" as a sub directory, which explains the above error.

I can deploy a debug build to a device, but I cannot build an AppStore release or do an Archive process. My project previously built fine using Visual Studio 2019, but I had to upgrade to get a certificate fix that was only corrected in Visual Studio 2022.

Is there any known fixes for this issue?

I'm using:

  • Visual Studio v17.3.1
  • Xamarin v5.0.0.2515
  • Windows 11 machine

Compiling against;

  • macOS Monterey v12.5.1
  • Xcode v13.4.1
2
  • Try to remove the bin directory (in the project) and all the files on Mac in ~/library/caches/mtbs/builds/ and then rebuild it. Commented Aug 24, 2022 at 6:58
  • Thanks for the suggestion but it did not resolve the issue.
    – LinkSoft
    Commented Aug 28, 2022 at 23:35

3 Answers 3

1

Comment out or delete this 'Unzip' task

<!--Unzip App Bundle on Windows-->
<Unzip Condition="Exists('$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip')" ZipFilePath="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" ExtractionPath="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName)$(AppBundleExtension)" /> 

in the file

..\Community\Msbuild\Xamarin\iOS\Xamarin.iOS.Common.After.targets

0

Same issue here. Opened MS dev com "Xamarin iOS deployment no longer works".

I did find something that works for me. Select to Archive iOS build and wait for error. Select View Archive + failing iOS build, tap Distribute, cancel the creds challenge, tap Open Folder, and submit the ipa to Apple.

0

Thank you, fractal4, your suggestion helped me build successfully, but the same issue reared its head trying to archive for the app store. Xamarin is out of support now, but I needed to push a tiny fix while working on our MAUI platform when I ran into this very annoying problem. After pulling my hair out and trying everything I could think of, I finally just removed the iOS project, renamed the folder, made a new blank iOS project that built, then copied all the files back in, and re-added them to the project. It now builds and archives successfully. I hoped to compare the projects and point out what the actual problem is, but there is no major difference I can find related to any paths in the new versus old .csproj files. Perhaps it is something that gets staged? In any case, while I cannot provide specifics, unfortunately, if anyone is badly stuck with this issue, I had luck going that route. Make a blank iOS project, make sure it builds -- then re-add your content. Hopefully, you have the same results.

Not the answer you're looking for? Browse other questions tagged or ask your own question.