iOS 构建失败,为 Cordova 6.1.0 生成了错误的项目名称

iOS build fails, produces wrong project name for Cordova 6.1.0

我将 vsts-cordova-tasks 与本地 TFS(2015 更新 1)结合使用。将 taco.json 中的 Cordova CLI 选项从 5.4.1 更新到 6.1.0 后,我的构建失败并出现如下错误:

Cordova version set to 6.1.0 based on the contents of taco.json
Module cache at /Users/rob/.taco_home/node_modules
cordova@6.1.0 already installed.
Adding support plugin.
Processing res/native for ios
Queueing build for platform ios w/options: none
Processing res/native for ios
cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/rob/agent/_work/5/s/myapp/platforms/ios/myapp/config.xml
ENOENT: no such file or directory, open '/Users/rob/agent/_work/5/s/myapp/platforms/ios/myapp/config.xml'

在构建代理源文件夹中,platforms/ios 下有一个 HelloCordova 文件夹,而不是预期的 myapp 文件夹。

如果我 运行 cordova remove platform ioscordova platform add ioscordova build 来自终端 ,则生成 platforms/ios 下的预期文件夹并构建按预期工作

编辑:首先使用 Cordova CLI 生成正确的文件夹,但随后重命名为 HelloCordova。

我猜构建任务没有找到 config.xml,其中包含正确的应用程序名称,并且正在回退到 HelloCordova?我试过在构建定义中设置工作目录,它似乎是正确的。只需更改 taco.json.

中的目标 Cordova 版本,我就可以让构建再次运行

构建步骤截图:

你能去platforms/ios/HelloCordova/config.xml看看你里面有没有HelloCordova。 (在本地或您的构建服务器上试用)

查看 platformis/ios 文件夹,文件夹的名称最初设置正确,但在更改为 HelloCordova 之后。

Install complete for cordova-plugin-whitelist on ios.
1>  Executing "after_plugin_install"  hook for "cordova-plugin-whitelist" on ios.
1>  Executing "before_prepare"  hook for all plugins.
1>  Executing "before_build"  hook for all plugins.
1>  Searching PlatformJson files for differences between project vs. platform installed plugins
1>  No differences found between project and ios platform. Continuing...
1>  Generating config.xml from defaults for platform "ios"
1>  Wrote out iOS Bundle Identifier to "com.cct.driverapp"
1>  Wrote out iOS Bundle Version to "1.0.0"
1>  Set IPHONEOS_DEPLOYMENT_TARGET to "9".
1>  Wrote out iOS Product Name and updated XCode project file names from "SomeAppName" to "HelloCordova".

我知道,这不是一个真正的答案,所以以后可以删除它,但希望现在能有所启发。

*创建新项目时不会发生。

解决方法:降级到 6.0.0 效果很好