Search code examples
ioscordovavisual-studio-cordova

VsTac task failed, could not find file appAsTgz.tgz when using global Cordova toolset


When I use my globally installed Cordova 7.1.0 toolset and do an iOS remote build (to simulator or to Local Device), I almost immediately get the error message:

Error   MSB4018 The "VsTac" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Users\joe\AppData\Local\Temp\appAsTgz.tgz'.
File name: 'C:\Users\joe\AppData\Local\Temp\appAsTgz.tgz'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode)
   at Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.RemoteBuild.AppAsTgzStream(String changeTimeFile, JObject lastChangeTimesMap)
   at Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.RemoteBuild.Build()
   at Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.VsTac.BuildPlatform()
   at Microsoft.VisualStudio.MultiDeviceHybridApps.MdaBuildTasks.VsTac.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() MyFleetGoTest   C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets 256 

I can do iOS and Android browser builds. I can change the toolset to <vs:toolsetVersion>6.3.1</vs:toolsetVersion> and the error goes away and the message succeeds.

Is it possible to use the global Cordova 7.1.0 install instead of the VS TACO 6.3.1 toolset and get working iOS remote builds? This is with Visual Studio 2017.


Solution

  • Latest way to compile for iOS using Cordova and Visual Studio 2017 (15.5)

    In Mac OS:

    • Install Xcode 9.*

    • Install Node.JS 6.*. (https://nodejs.org/dist/latest-v6.x/) - Newer NPM version doesn't work for now.

    • Install Xcode components via terminal: xcode-select -–install

    • Install "remotebuild" Microsoft tool for remote compile from Visual Studio (Windows): sudo npm install -g remotebuild

    • Install COCOA Pods (needed by newer Cordova 7.1.0): sudo gem install cocoapods

    • Setup COCOA Pods for your first use just running command (about 680 MB to download): pod setup

    ​ - Set permissions:

    sudo chown -R $USER:$GROUP ~/.npm

    sudo chown -R $USER:$GROUP ~/.config

    • Start remotebuild to start listen: remotebuild

    In Windows:

    From

    <vs:toolsetVersion>6.3.1</vs:toolsetVersion>

    To

    <vs:toolsetVersion>GlobalCordovaVersion</vs:toolsetVersion>

    • Remove the follow lines from config.xml (open using xml editor):

    <engine name="android" spec="5.2.1" /> //if the file has another line with a newer version

    <engine name="ios" spec="4.2.0" /> //if the file has another line with a newer version

    <engine name="windows" spec="4.4.2" /> //if the file has another line with a newer version

    <preference name="windows-target-version" value="10.0" /> //if the file has another line with a newer version

    • Setup Visual Studio (Tools > Options > Tools For Apache Cordova)​ with the config generated by remotebuild (running in Mac OS). Screen example: Remote Agent Output

      • Tip: Try a ping before configure. If you have a problem, use IP instead computer name.
    • Build. You can locate your *.ipa file in bin\iOS\Debug folder.