Forum Visual Studio

"The 'UnpackLibraryResources' task failed unexpectedly" error compiling iOS after upgrade to 4

JohnDBJohnDB USMember ✭✭

The above error has just started occurring after our upgrade to Xamarin 4.

Here is the scenario:

We are using Visual Studio 2015 running in a Windows VM within Parallels on a MacBook Pro. The solution code is hosted on the Mac (not in Windows vm) and this is the crux of the problem.

As you will see in the attached file that contains the stack trace of the error, the exception thrown is a System.UnauthorizedAccessException accessing "/Mac".

If the code is hosted on Windows we don't get the error, but the point is that this used to work before the upgrade.

It looks like it's just a bug, but I thought you'd want to know (we can workaround for the time being), though if you know of a solution I'd appreciate it if you could let me know.



  • MatthewWoodMatthewWood GBMember

    I get the same error though slightly different

    Severity Code Description Project File Line Column 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 at Xamarin.Messaging.VisualStudio.MessagingService.UploadFile(Stream stream, String appName, String sessionId, String path, Boolean useCache) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\Messaging\Xamarin.Messaging.VisualStudio\MessagingService.cs:line 353 at Xamarin.Messaging.VisualStudio.MessagingService.UploadFile(String appName, String sessionId, String path, Boolean useCache) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\Messaging\Xamarin.Messaging.VisualStudio\MessagingService.cs:line 342 at Xamarin.VisualStudio.Build.BuildClient.UploadItem(String path) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 106 at Xamarin.VisualStudio.Build.TaskRunner.CopyRequiredInputFiles(Task task) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 224 at Xamarin.VisualStudio.Build.TaskRunner.Run(Task task) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 68 at Xamarin.MacDev.Tasks.UnpackLibraryResources.Execute() in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.MacDev.Tasks\Tasks\UnpackLibraryResources.cs:line 14 at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() PartsArena2.iOS

  • I have the same error as @MatthewWood . It's okay to understand the error, but where to locate it? What and where is too long?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    I'm getting the same behavior.

  • kzukzu USXamarin Team, Insider Xamurai

    Are you opening the solution from a network share? If so, can you please try moving it to a local drive (or a mapped one)?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    @kzu Opening the solution from a mapped drive worked for me.

  • sfinnsfinn USMember

    I have also been experiencing something similar to this.

    Project is stored on my machine.

  • sfinnsfinn USMember

    I was able to find a workaround by moving my project to a location that was not as deep on my machine.

  • kzukzu USXamarin Team, Insider Xamurai

    Awesome @JoeManke, thanks for confirming.

  • JohnDBJohnDB USMember ✭✭

    You know when you read something and think, why didn't I try that? :smile:
    I can confirm that the error does not occur if you use a mapped drive. Thanks for the info.

  • Same problem with Windows 10 in parallels on a Mac Pro:

    Fixed after using mapped drive.

    Error 5 The "UnpackLibraryResources" task failed unexpectedly.
    Xamarin.Messaging.Exceptions.MessagingRemoteException: An error occured on client Build4001689 while executing a reply for topic xvs/Build/ ---> System.UnauthorizedAccessException: Access to the path "/psf" is denied.

  • mafmaf USMember ✭✭

    When I attached a debugger to msbuild.exe and listened for PathTooLongException, I was able to identify the culprit path as this:

    So apparently a temporary path is being generated on the mac, based on concatenating the full absolute path of a dll on the windows machine?

  • RonSijmRonSijm USMember

    I have the same problem:

    Error 5 The "UnpackLibraryResources" task failed unexpectedly.
    Xamarin.Messaging.Exceptions.MessagingRemoteException: An error occured on client Build4001689 while executing a reply for topic xvs/Build/ ---> System.UnauthorizedAccessException: Access to the path "/" is denied.

    I tried making a network map to my mac, but that did not work either.
    When opening the project visual studio shows the message box say

    Driver Testing
    Could not load test information. Error: [HRESULT: 0x80070032] Failed to get the security descriptor for '\\ron\dev\project'.

    Just having the source code locally does not work, as I'm trying to work on a UITest project, and I cannot run the UITests from my windows machine. I have to run them from Xamarin on the mac.
    So my workflow for that is to open source code from the network drive, build for a while, then run for my mac. Otherwise I constantly have to commit on my windows machine and pull from the mac.

    If there is a way to run these tests from my windows machine, that'd be even better

  • @kzu Thanks it worked. Mapped network drive and symbolic link is working as well.
    But becuase TFS I just mapped an inner source directory to a very short path to my local drive and the problem is solved.

  • ArrenArren USMember

    I can't seem to find a bug for this, has one been created yet?

    Our setup worked perfectly fine prior to Xamarin 4.0 and now fails because the path is too long. As a work-around so we're not blocked we can remap it to a shorter path, but that is a bandaid. Nothing is stoping the issue from arising again because of how we choose to organize our code, or some OS/Xamarin change that increases the length of the paths.

  • kzukzu USXamarin Team, Insider Xamurai

    @ArrenMund are you using a network location or a local directory?

  • ArrenArren USMember

    @kzu local directory. It's the same issue as maf.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
    edited November 2015

    For reference, the change in behavior in Xamarin 4.0 related to path lengths (and especially path lengths in combination with network shares) as discussed in this forum thread is now being tracked in public Bug 36195.

    See also the Xamarin 4 Release Announcement for information about other known issues in the latest release, including a link to the full "Xamarin 4 Bug List." (That full list now includes Bug 36195.)

  • Sten.5163Sten.5163 USMember

    I'm having issues with Xamarin in VS as well
    The project wouldn't build, it builds on Mac.

    Severity Code Description Project File Line
    Error System.IO.FileNotFoundException: /Users/Sten/Library/Caches/Xamarin/mtbs/builds/325iOS/42ac120735fcf77e0409a06916217d98/obj/iPhoneSimulator/Debug/optimized/Default.png does not exist
    File name: '/Users/Sten/Library/Caches/Xamarin/mtbs/builds/325iOS/42ac120735fcf77e0409a06916217d98/obj/iPhoneSimulator/Debug/optimized/Default.png'
    at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) <0x19ff7f0 + 0x00333> in :0
    at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) <0x3b01a78 + 0x000c7> in :0
    at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () <0x3b01288 + 0x00227> in :0 325Math.iOS

  • kzukzu USXamarin Team, Insider Xamurai

    Does the error continue Sten if you rebuild?

  • kzukzu USXamarin Team, Insider Xamurai

    If the error persists, it would be very useful if you could also get a diagnostics output from msbuild


  • AdrianKnightAdrianKnight USMember ✭✭✭✭

    I'm also getting the PathTooLongException exception.

  • AdrianKnightAdrianKnight USMember ✭✭✭✭

    I was able to solve the problem by remapping my project to a shorter directory path as well.

  • gjhdigitalgjhdigital USMember ✭✭

    I was getting the "unpacklibraryresources" error but now I am able to connect and run a test app that has a Mapped drive.
    But a real project Im working on with a mapped drive gives me this error below. Any help is appreciated.

    Severity Code Description Project File Line Suppression State
    Error There was an unhandled exception trying to deploy and run your application.
    System.NullReferenceException: Object reference not set to an instance of an object.
    at Xamarin.VisualStudio.IOS.MonoTouchProjectProperties.MatchesBuildSignature() in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\Core\VisualStudio.IOS\PropertyProviders\MonoTouchProjectProperties.cs:line 78
    at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.DebugLaunch(__VSDBGLAUNCHFLAGS grfLaunch, IProgressReport& progress) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 600
    at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.DebugLaunch(__VSDBGLAUNCHFLAGS grfLaunch) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 529 0

  • kzukzu USXamarin Team, Insider Xamurai

    We do not officially support using network paths for your source

  • gjhdigitalgjhdigital USMember ✭✭

    Attached is my log file. I have the project on my local machine "C:\RTMobile". And Im getting this error if I open the solution locally. So I made a mapped drive to the same folder and getting the same error.

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    Those errors seem to indicate a communication problem between your Windows and Mac servers.

  • kzukzu USXamarin Team, Insider Xamurai

    @GregHerrmann indeed:

    [2016-08-09 12:15:49.6930] Couldn't connect to Please try again.

    Try the troubleshooting guide please:

  • gjhdigitalgjhdigital USMember ✭✭

    Odd, Im able to make a test project and connect to my mac without issue on 2 separate computers (win 8.1 and win 10)

  • VitaliiSmalVitaliiSmal USMember
    edited November 2016

    +1, also have this issue, but helps clean & rebuild solution

  • HirHir USMember ✭✭

    when two machine try to connect with single MAC at same time ,This problem happens , So try to clean and Rebuild your Solutions. :)

  • JayBowmanJayBowman USMember ✭✭

    I've had this error a couple of times and a clean and rebuild works. :)

  • SJ-87SJ-87 USUniversity ✭✭

    I have the same problem, frequently getting this "The UnpackLibraryResources task failed unexpectedly" for all project builds.
    Using Visual studio 2015, Mapped to local.

    1.The ACTool task failed unexpectedly
    2.One or more errors occured .iOS
    3.The UnpackLibraryResources task failed unexpectedly
    4.The OptimizeImage task failed unexpectedly
    5.Could not find SDK "SQLite.WinRT81, Version=3.16.2"
    6.Unable to connect to Address='' with User='asdf'
    7.The client build25944asdf has been disconnected while waiting a post response to topic xvs/Build/
    8.The client build25944asdf has been disconnected while waiting a post response to topic xvs/Build/
    9.The client build26564asdf has been disconnected while waiting a post response to topic xvs/Build/

    done with Clean solution, rebuild sol'n, restart the Windows, Visual studio, reboot the simulator, restarted the systems, and clean and rebuild the solution. But still it threw above mentioned errors. It screwed me over again.

    Any help really appreciated.

  • ziadhawamdehziadhawamdeh USMember

    it's working fine just you need to close and open your project then rebuild the project it will work fine. :)

  • MahibaRajaseelanMahibaRajaseelan USMember ✭✭

    This may also occur when you try adding or deleting a package from NuGet. Try to clean and Rebuild your Solutions. It will workout.

  • AswathiPSAswathiPS USMember ✭✭

    it just reconnect the mac pc with visual studio going through Tools -> iOS -> Xamarin Mac Agent. and click on Connect button.

  • I'm also face the same problem. If you have done change outside the network mapped and checked into network then you will face this kind of issue. better Copy the same outside the mapped network and try to rebuild. for me it's worked.

Sign In or Register to comment.