由于文件传输插件,Cordova 应用程序未针对 Windows Phone 8 构建

Cordova app not building for Windows Phone 8 due to file-transfer plug-in

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

$ 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.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 class 中明显不存在的成员的引用。 Github 上托管的插件源中的这些引用 can be seen。 Android 和 iOS 的构建工作正常。

有没有其他人遇到过这个问题,如果有,你是如何解决的?

在此先感谢您提供的任何帮助。

我已经解决了这个问题。这是由另一个插件 org.apache.cordova.file 引起的,它缺少来自 [=12] 的单个 File.cs 源文件=]Plugins\org.apache.cordova.file目录。我将它从 Github 复制到我的解决方案中,现在它可以毫无问题地构建。