由于文件传输插件,Cordova应用程序无法为Windows Phone 8构建

时间:2015-04-24 15:46:31

标签: cordova windows-phone-8

我有一个可在Android,iOS和Windows Phone 8平台上运行的Cordova应用程序。在对需要添加其他插件的应用程序进行更新后,由于 org.apache.cordova.file-transfer <的版本中出现编译错误,我无法执行Windows Phone 8的构建。 / em>插件。这是尝试构建时的输出:

$ cordova build wp8
Running command: cmd "/s /c ""D:\MyPhonegapProject\platforms\wp8\cordova\build.bat"""

Building project: D:/MyPhonegapProject/platforms/wp8/MyPhonegapApp.sln
        Configuration : debug
        Platform      : any cpu
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Plugins\org.apache.cordova.file-transfer\FileTransfer.cs(445,26): error CS0426: The type name 'FileEntry' does not exist in the type 'System.IO.File' [D:\MyPhonegapProject\platforms\wp8\MyPhonegapApp.csproj]
Plugins\org.apache.cordova.file-transfer\FileTransfer.cs(445,49): error CS0117: 'System.IO.File' does not contain a definition for 'FileEntry' [D:\MyPhonegapProject\platforms\wp8\MyPhonegapApp.csproj]
Plugins\org.apache.cordova.file-transfer\FileTransfer.cs(452,96): error CS0117: 'System.IO.File' does not contain a definition for 'NOT_FOUND_ERR' [D:\MyPhonegapProject\platforms\wp8\MyPhonegapApp.csproj]
Plugins\org.apache.cordova.file-transfer\FileTransfer.cs(631,26): error CS0426: The type name 'FileEntry' does not exist in the type 'System.IO.File' [D:\MyPhonegapProject\platforms\wp8\MyPhonegapApp.csproj]
Plugins\org.apache.cordova.file-transfer\FileTransfer.cs(631,53): error CS0426: The type name 'FileEntry' does not exist in the type 'System.IO.File' [D:\MyPhonegapProject\platforms\wp8\MyPhonegapApp.csproj]
ERROR: Error code 1 for command: C:\Program Files (x86)\MSBuild\12.0\bin\msbuild with args: D:/MyPhonegapProject/platforms/wp8/MyPhonegapApp.sln,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=debug,/p:Platform=any cpu
ERROR building one of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
    at ChildProcess.whenDone (C:\Users\Me\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

正如错误消息所示,问题源于插件的本机代码中对System.IO.File类显然不存在的成员的引用。在Github上托管的插件源中的这些引用can be seen。适用于Android和iOS的构建工作正常。

是否还有其他人遇到此问题,如果有,您是如何解决的?

提前感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题。它是由另一个插件 org.apache.cordova.file 引起的,缺少 Plugins \ org.apache中的单个 File.cs 源文件。 cordova.file 目录。我将它从Github复制到我的解决方案中,现在它构建没有任何问题。