当我使用全局安装的 Cordova 7.1.0 工具集并执行 iOS 远程构建(到模拟器或本地设备)时,我几乎立即收到错误消息:
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
我可以构建 iOS 和 Android 浏览器。我可以将工具集更改为 <vs:toolsetVersion>6.3.1</vs:toolsetVersion>
错误消失,消息成功。
是否可以使用全局 Cordova 7.1.0 安装而不是 VS TACO 6.3.1 工具集并开始运行 iOS 远程构建?这是 Visual Studio 2017。
最佳答案
使用 Cordova 和 Visual Studio 2017 (15.5) 为 iOS 编译的最新方法
在 Mac 操作系统中:
安装 Xcode 9.*
安装 Node.JS 6.*。 ( https://nodejs.org/dist/latest-v6.x/ ) - 较新的 NPM 版本目前无法使用。
通过终端安装 Xcode 组件: xcode-select --install
安装“remotebuild”Microsoft 工具,用于从 Visual Studio (Windows) 进行远程编译: sudo npm install -g remotebuild
安装 COCOA Pods(较新的 Cordova 7.1.0 需要): sudo gem install cocoapods
首次使用时只需运行命令即可设置 COCOA Pods(下载约 680 MB): 广告连播设置
- 设置权限:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
- 启动 remotebuild 开始监听: 远程构建
在 Windows 中:
安装更新的 Visual Studio 2017 (15.5)...
安装 Node.JS 6.*。 ( https://nodejs.org/dist/latest-v6.x/ ) - 较新的 NPM 版本目前无法使用。
安装 Global Cordova 版本(与较新的平台和 iOS 版本兼容): npm install -g cordova
- 直到现在,当 Cordova 项目加载 VS 强制集以使用 Cordova 工具集 6.3.1 时,VS 2017 有一个错误 (https://developercommunity.visualstudio.com/content/problem/94814/vs-153-cordova-cannot-use-global-cordova-anymore.html)。要解决它(解决方法):
- 更改 config.xml 中的以下行(使用 xml 编辑器打开):
来自
<vs:toolsetVersion>6.3.1</vs:toolsetVersion>
到
<vs:toolsetVersion>GlobalCordovaVersion</vs:toolsetVersion>
- 从 config.xml 中删除以下行(使用 xml 编辑器打开):
<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
使用 remotebuild(在 Mac OS 中运行)生成的配置设置 Visual Studio(工具 > 选项 > Tools For Apache Cordova)。屏幕示例: Remote Agent Output
- 提示:在配置前尝试 ping。如果您遇到问题,请使用 IP 而不是计算机名称。
构建。您可以在 bin\iOS\Debug 文件夹中找到您的 *.ipa 文件。
关于ios - VsTac 任务失败,使用全局 Cordova 工具集时找不到文件 appAsTgz.tgz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47524425/