'Cannot create IOS archive: Path (directory name must be less than 248 characters) and/or file name (must be less than 260 characters) are too long

ERROR

Cannot create IOS archive 'MyIosProject'. Process cannot be executed on XMA server. There was an error unzipping the file C:\Users\myusername\AppData\Local\Xamarin\iOS\Archives\2020-04-08\ac002825.zip: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

WHAT I HAVE TRIED SO FAR

  1. Enable long file name support in Windows 10 Start the registry editor (regedit.exe) Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem. Double click LongPathsEnabled. Set to 1 and click OK. Reboot.
  2. Hit the Windows key, type gpedit.msc and press Enter. Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem > NTFS. Double click the Enable NTFS long paths option and enable it. If you're using a version of Windows that does not provide access to Group Policy, you can edit the registry instead. Reboot.
  3. Add this to your .csproj file: <PropertyGroup><UseShortFileNames>True</UseShortFileNames></PropertyGroup>

None of the above solved my issue.



Solution 1:[1]

UPDATE: you can now specify this directory in Visual Studio under Tools -> Options -> Xamarin -> iOS Settings -> Archives. I have changed this path to: C:\Users\myusername\0

enter image description here

I had to update all my NuGet packages. Deleted obj and bin folders, restored nuget packages for the solution and rebuilded my project and on Windows also had to delete all IntermediateOutputPath in my csproj file of iOS project.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1