3
votes

I have a Cordova project with windows 10 platform added. I also have a native plugin, built as a Windows Runtime Component (https://github.com/apache/cordova-plugin-globalization). This works fine in debug mode, but when trying to make app packages for store submission strange things happen.

First of all, in .jsproj file UseDotNetNativeToolchain was set to false, if I create packages with that configuration, store complains about missing Windows.Net.Core. I found out this means that I need to enable .net native, so I did. After I submit such .appx package, store complains: "You cannot submit pre-compiled .NET Native packages. Please upload the Store appxupload file and try again." which I don't have.

After some digging I tried to make appxupload file without Visual Studio, using the MSBuild. I managed to compose a command which would produce an .appxupload, this was done with these command parameters: /p:Platform=x86;Configuration=Release /p:UapAppxPackageBuildMode=CI /target:Clean;Publish. Now the store didn't complain and app went through certification only to fail when I install it. It looks like .net native didn't pack the required native components of plugin correctly (.winmd, .dlls). And indeed when I just compile it in release mode with .net native enabled, I see these are not included.

I have to mention Cordova build command fails as it messes up appxmanifest file by setting application id to identity name which is not valid for this field. I couldn't find any official way of doing this, all the examples are for simple hello world apps, nothing that includes native plugins. So I wonder is this even possible to do, build cordova project using .net native and producing valid .appxupload packages?

2
What version of the VS Cordova tools are you using? We've made lots of bug fixes for Windows packaging. Can you please make sure you're using the latest? (Disclosure: I work on the Tools for Apache Cordova in Visual Studio). - Michael Braude
Also: can you try moving to Cordova 5.3.3 if you're not already on it? (5.4.1 has some issues with VS TACO Update 4). - Michael Braude
I had cordova cli 5.2.0. WIll update now to 5.3.3 and try with that. Just to note, I don't use Visual Studio for all cordova platforms, I added windows platform through Cordova CLI, and then opened the windows project in Visual Studio. Is that ok? I suspect that is the same, as I'm not interested in other platforms right now. Also, I'm not sure how to check VS Cordova tools version. Thanks - stipe
Ok, to make it simpler, start a new Cordova app from the template, set Windows target to 10 them make app packages for the store. Do you get the .appxupload file? Because I don't and I suppose it should create them like it does for win 8.1. Next problem is when I have a plugin built as a runtime component which has two .dlls, those don't get included into release package. - stipe

2 Answers

1
votes

I have solved it by removing the Store Association file from the .projitems file and add it to the .jsproj file. After this Visual Studio generates the .appxupload file again. Additional help here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9b4cc8dc-c87b-4f62-a244-8d115683560b/appxupload-file-is-not-generated?forum=wpdevelop

Delete from .projitems:

<None Include="$(MSBuildThisFileDirectory)Package.StoreAssociation.xml" />

Add to .jsproj:

<ItemGroup>
  <None Include="Package.StoreAssociation.xml" />
</ItemGroup>
0
votes

I have exactly this compilation error but with then cordova-plugin-websql plugin. I have edited jsproj and setted all UseDotNetNativeToolchain to false. After that, the native compilation always starting (release compilation for store packages). i have made the same compilation test with different cordova plugin, but it seems this native compilation start if the plugin reference a winmd file.