pwa-builder / ManifoldCordova

JS Plugin for Cordova
Other
94 stars 93 forks source link

Windows 10 UWP / Visual Studio Cordova Tools... Wrapper.js copy error #84

Closed ABPGeorg closed 7 years ago

ABPGeorg commented 7 years ago

i'm using visual studio 2015 with Cordova tools installed (cordova 6.1.1). Have used Cordova CLI to add hosted webapp plugin. When trying to build Windows 10 UWP version, the build process is unable to copy wrapper.js to platforms/windows/www/js/ as the js folder does not exist.

Copying wrapper js file for the windows platform from E:[REMOVED]\plugins\cordova-plugin-hostedwebapp\assets\windows\wrapper.js to E:[REMOVED]\platforms\windows\www\js\wrapper.js. 1>MSBUILD : cordova-build error : [Error: ENOENT, open 'E:[REMOVED]\platforms\windows\www\js\wrapper.js']

My workaround: I've updated "copyFile" function in replaceWindowsWrapperFiles.js to create the copy destination directory if it doesnt exist.

Just wanted to make sure I've not done anything wrong and my workaroudn was the correct workaround. Thanks

boyofgreen commented 7 years ago

This is very intersesting, and I haven't ran into this before. You mentioned that you are using the CLI here (I think VS in the other scenerio) but when the project created VS or the CLI. Also, are you using a JSON manifest with the plugin, if so can you share?

ABPGeorg commented 7 years ago

Hi! Keeps happening even when I create a new empty project with the plugin added directly via VS. Steps to recreate: 1) Create a new Cordova project with Visual Studio 2015 (with Visual Studio cordova tools installed) 2) add a manifest.json: My test app's is as simple as this:

{ "lang": "en", "name": "WebHost Platform Test", "short_name": "WebHostPlatFormTest", "icons": [ { "src": "icon/lowres", "sizes": "64x64", "type": "image/webp" }, { "src": "icon/hd_small", "sizes": "64x64" }, { "src": "icon/hd_hi", "sizes": "128x128", "density": 2 } ], "scope": "/", "start_url": "http://127.0.0.1:8000/", "display": "fullscreen", "orientation": "landscape", "theme_color": "aliceblue" }

3) change config.xml (edit SOURCE) to include the plugin manually (as it's not listed in the prepopulated list):

<plugin name="cordova-plugin-hostedwebapp" version="0.3.1" />

4) In config.xml (NOT in edit source mode but normal double-click-on-file-mode), go to "Windows" tab and select Windows 10.0

5) In config.xml you can also make sure Platforms tab has Cordova 6.1.1 showing (Use globally Corodva version NOT ticked)

Hope this helps! -Georg

ABPGeorg commented 7 years ago

Further investigation: If I create a project and add the plugin via command line only (not using Visual Studio) then all works fine. it's only when I try to create the project and add the plugin via Visual Studio 2015. Also I have to add the plugin directly into config.xml or via command line because when i try to add it via the config.xml visual designer, visual studio complains about not being able to read / parse plugin.xml visual studio has the option to install plugins via id, git or local... none of the options worked.

boyofgreen commented 7 years ago

we'll work with VS team to identify issue

aaronwjha commented 7 years ago

Any news on this? I'm seeing the same issue.

boyofgreen commented 7 years ago

Hi @aaronwjha and @ABPGeorg I wasn't able to recreate this before, but I'm seeing the same thing now. I'll reach out to the team. @jasonshortphd do you have any ideas? I think work around would be to manually move the wrapper.js file yourself but that's not a good solution.

monobjorn commented 6 years ago

The error Visual Studio gives you is because there are "<" characters in plugin.xml (in the version attribute):

<engine name="cordova-windows" version="<=4.3.9" />
<engine name="cordova-ios" version="<=4.1.9" />
<engine name="cordova-android" version="<=5.1.9" />

By replacing "<" with "&lt;" Visual Studio will accept the file:

<engine name="cordova-windows" version="&lt;=4.3.9" />
<engine name="cordova-ios" version="&lt;=4.1.9" />
<engine name="cordova-android" version="&lt;=5.1.9" />