ioscordovavisual-studio-cordovavisual-studio-2017taco

VS2017 - Ionic/Cordova - Unable to build iOS RemoteBuild - Path too long


I have recently upgraded to VS2017 from VS2015 and am now unable to build my Ionic Cordova project for iOS.

I can build for Android fine.

I copied over the iOS remote build settings across (and have checked that the server it up and running on my Mac, etc.) but when I try and build, I get the below error:

1>------ Build started: Project: PROJECTNAME, Configuration: Debug iOS ------
Cordova 6.3.1
------ Platform ios already exists
 ____                      _       _           _ _     _ 
|  _ \ ___ _ __ ___   ___ | |_ ___| |__  _   _(_) | __| |
| |_) / _ \ '_ ` _ \ / _ \| __/ _ \ '_ \| | | | | |/ _` |
|  _ <  __/ | | | | | (_) | ||  __/ |_) | |_| | | | (_| |
|_| \_\___|_| |_| |_|\___/ \__\___|_.__/ \__,_|_|_|\__,_|

-----------------------------------------------------------------------------
Sending the build to the remote build server
-----------------------------------------------------------------------------
------ Incremental Build: False
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018: The "VsTac" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018: 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.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018:    at System.IO.PathHelper.GetFullPathName()

I have tested this without the remote build agent running and it still fails so I suspect this is something to do with my Windows machine. However, since Android builds fine I'm not sure.

I am not sure what to try from here; not sure how to debug this further.

Any ideas?


Solution

  • This is probably happening because your project has npm packages with long nested file paths. Remote build fails to copy them because they exceed the max_path limitation of Windows.

    Moving your project closer to the root of your drive should fix the problem.