用于Apache Cordova的工具在TFS上构建失败

时间:2016-01-13 21:19:46

标签: android cordova tfsbuild hybrid-mobile-app visual-studio-cordova

我在TFS 2013上收到构建Cordova应用程序的错误。具体来说,它总是无法在特定于平台的screen.png文件上进行某种操作。其他帖子谈到与文件被标记为只读相关的问题,但是我无法使用我发现的任何解决方案来使构建工作。有什么想法吗?

...
                     Install complete for cordova-plugin-customurlscheme on android. (TaskId:12)
                     Executing "after_plugin_install"  hook for "cordova-plugin-customurlscheme" on android. (TaskId:12)
                     Searching PlatformJson files for differences between project vs. platform installed plugins (TaskId:12)
                     No differences found between project and android platform. Continuing... (TaskId:12)
                     Generating config.xml from defaults for platform "android" (TaskId:12)
                     Wrote out Android application name to "My App" (TaskId:12)
15:10:15.163     2>MDAVSCLI : error : EPERM, operation not permitted 'D:\Builds\Cordova\MyApp\src\MyApp\platforms\android\res\drawable-land-hdpi\screen.png' [D:\Builds\Cordova\MyApp\src\MyApp\MyApp.jsproj]
                   Done executing task "MdaVsCli" -- FAILED. (TaskId:12)

2 个答案:

答案 0 :(得分:2)

您需要检查以下内容:

  1. 确保“screen.png”的路径未设置为“只读”。
  2. 确保构建服务使用的帐户具有足够的权限来访问该文件。 (尝试使用管理员帐户运行构建服务)
  3. 如果仍然无效,请尝试在构建之前添加一个步骤以检出文件。同样的问题可以在这里提到:https://social.msdn.microsoft.com/Forums/vstudio/en-US/81d5e57c-49bd-4487-a198-7930b48412b5/error-building-windows-x64-windows-x86-or-windows-anycpu

答案 1 :(得分:2)

我终于找到了解决方案。我添加了一个before_prepare挂钩来从文件中删除只读标志。我添加了文件hooks / before_prepare / undoReadOnly.bat以及下面的内容。请注意,我必须在Visual Studio外部编辑它们并使用ANSI编码保存它们以便能够读取它们:

echo before_prepare hook - undoReadOnly
echo MSBuildProjectDirectory=%MSBuildProjectDirectory%
attrib -r %MSBuildProjectDirectory%\MyApp\platforms\*.* /S /D