Bug 36195 - [XVS.iOS 4.0] "The 'UnpackLibraryResources' task failed unexpectedly" caused by a PathTooLongException or UnauthorizedAccessException, commonly observed when building projects stored on a network share
Summary: [XVS.iOS 4.0] "The 'UnpackLibraryResources' task failed unexpectedly" caused ...
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: 4.0.1 (C6SR1)
Assignee: Adrian Alonso
URL:
: 33128 36274 ()
Depends on:
Blocks:
 
Reported: 2015-11-24 04:01 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-12-10 23:53 UTC (History)
6 users (show)

Tags: BZSRC6S1
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 04:01:31 UTC
[XVS.iOS 4.0] "The 'UnpackLibraryResources' task failed unexpectedly" caused by a PathTooLongException or UnauthorizedAccessException, commonly observed when building projects stored on a network share




## Regression status: behavioral regression in Xamarin 4.0 compared to Xamarin 3.11

Xamarin 4.0 apparently changed how some paths are constructed or used internally during the build process, causing this issue to affect users who had not seen it previously.




## Possible workarounds

This problem is caused by path lengths that are too long for the file access APIs used by Visual Studio and MSBuild. There are various ways to reduce the path length of the project directory.

One way to reduce the path length of a network share on Windows is to map [1] it to a drive letter or to a shallow folder.

[1] http://windows.microsoft.com/en-us/windows/create-shortcut-map-network-drive




## Error messages


### Top of the stack trace for a "PathTooLongException"

> Error       The "UnpackLibraryResources" task failed unexpectedly.
> System.IO.PathTooLongException: 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.
>    at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
>    at System.IO.Path.GetDirectoryName(String path)
>    at Xamarin.Messaging.VisualStudio.MessagingService.UploadFile(Stream source, String file, Boolean calculateChecksum, Int32 retryAttemps, String description, Boolean logProgress, Boolean useCache) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\Messaging\Xamarin.Messaging.VisualStudio\MessagingService.cs:line 369



### Example top of the stack for an "UnauthorizedAccessException"

> Error		The "UnpackLibraryResources" task failed unexpectedly.
> Xamarin.Messaging.Exceptions.MessagingRemoteException: An error occured on client Build4001689 while executing a reply for topic xvs/Build/4.0.0.1689/copy-item/iPhoneApp00001/18f8243/GalaSoft.MvvmLight.dll ---> System.UnauthorizedAccessException: Access to the path "/Mac" is denied.
>   at System.IO.Directory.CreateDirectoriesInternal (System.String path) <0x19fb7a0 + 0x00148> in <filename unknown>:0 
>   at System.IO.Directory.CreateDirectory (System.String path) <0x19fb590 + 0x000c7> in <filename unknown>:0 
>   at System.IO.DirectoryInfo.Create () <0x19fda50 + 0x00020> in <filename unknown>:0 
>   at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
>   at System.IO.Directory.CreateDirectoriesInternal (System.String path) <0x19fb7a0 + 0x000f9> in <filename unknown>:0 
>   at System.IO.Directory.CreateDirectory (System.String path) <0x19fb590 + 0x000c7> in <filename unknown>:0 
>   at System.IO.DirectoryInfo.Create () <0x19fda50 + 0x00020> in <filename unknown>:0 
>   at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 04:02:02 UTC
Corresponding forum thread for bookkeeping:

http://forums.xamarin.com/discussion/56003/the-unpacklibraryresources-task-failed-unexpectedly-error-compiling-ios-after-upgrade-to-4/p1
Comment 3 xamarin-release-manager 2015-11-24 09:56:49 UTC
Fixed in version 99.0.0.767 (master)

Author: Adrian Alonso
Commit: ffc86cec9b5680f5ebd4b14fdef486b76a9226da (xamarin/XamarinVS)
Comment 4 xamarin-release-manager 2015-11-26 10:40:28 UTC
Fixed in version 4.0.1.1 (cycle6)

Author: Adrian Alonso
Commit: ffc86cec9b5680f5ebd4b14fdef486b76a9226da (xamarin/XamarinVS)
Comment 5 Adrian Alonso 2015-11-30 22:27:58 UTC
*** Bug 36274 has been marked as a duplicate of this bug. ***
Comment 6 Ben Beckley 2015-12-10 23:53:06 UTC
*** Bug 33128 has been marked as a duplicate of this bug. ***