Can't create Windows Phone appx bundle from Cordova project

1.5k views Asked by At

I need to create an appxbundle file for Windows Phone Store but unfortunately, the Visual Studio 2015 RC Cordova Tools build only appxupload with appx file. The Cordova version is 5.0.0.

I've found two workarounds from this post.

Unfortunately, none of them is working. The first one

1.) Another way to create appx bundle is to modify the jsproj (project file) by adding following properties and then building the project.

 <AppxBundle>Always</AppxBundle>
 <AppxBundlePlatforms>neutral</AppxBundlePlatforms>

like

<PropertyGroup>
    <TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
    <TargetPlatformVersion>8.1</TargetPlatformVersion>
    <RequiredPlatformVersion>8.1</RequiredPlatformVersion>
    <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
    <DefaultLanguage>en-US</DefaultLanguage>
    <PackageCertificateKeyFile>CordovaApp_TemporaryKey.pfx</PackageCertificateKeyFile>
    <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
    <AppxBundle>Always</AppxBundle>
    <AppxBundlePlatforms>neutral</AppxBundlePlatforms>
  </PropertyGroup>

is still building an appxupload file, both from the Project > Store > Create App Packages option and from a regular build.

The second one

  1. Open native project -- after building the project, you will find native project under platforms\windows directory.
  2. In native project, you can use Create App Package wizard to specify that you want to create Bundle.

doesn't work because I get the following errors during build

Severity    Code    Description Project File    Line
Error       Build: File 'path\to\cordova\project/windows/www/app/app.js' must have extension '.ts' or '.d.ts'.  CordovaApp.Phone    path\to\cordova\project\platforms\windows\VSTSC 1
Error       Build: File 'path\to\cordova\project/windows/www/app/otherFile.js' must have extension '.ts' or '.d.ts'.    CordovaApp.Phone    path\to\cordova\project\platforms\windows\VSTSC 1
Error       Build: File 'path\to\cordova\project/windows/www/app/file.html' must have extension '.ts' or '.d.ts'.   CordovaApp.Phone    path\to\cordova\project\platforms\windows\VSTSC 1
(...)

How can I fix any of this errors? How can I generate appxbundle file? Can I do in some other way, outside of VS, from command line?


Update: So I've figured out how to disable TypeScript compiler in a project by setting Condition="False" in this lines:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.jsproj.targets" Condition="False" />

After that I can build the project but creating an app package results in this errors:

    Severity    Code    Description Project File    Line
Error       0x80080204 - The specified package format is not valid: The package manifest is not valid.  CordovaApp.Phone    X:\Work\Partner Program\mobile\PartnerProgramMobile\platforms\windows\MakeAppx  1
Error       Manifest validation error: Line 21, Column 54, Reason: The file name "www\index.html" declared for element "m:Applications/m:Application" doesn't exist in the package. CordovaApp.Phone        X:\Work\Partner Program\mobile\PartnerProgramMobile\platforms\windows\MakeAppx  1
Error       Package creation failed.    CordovaApp.Phone    X:\Work\Partner Program\mobile\PartnerProgramMobile\platforms\windows\MakeAppx  1

The www/index.html file exists. How can I fix that?

1

There are 1 answers

0
Kenneth Li On BEST ANSWER

people have problems using vs2015 after manually upgrade cordova to 5.0.0.

that means yours is not the only problem with 5.0.0. I believe it's better to wait until officially upgrade.

try the original version 4.3.0