Klors
Klors

Reputation: 2674

Windows Phone 8.1 HTML Company Apps - Can't install company app

I'm having problems trying to deploy any kind of HTML application for Windows Phone 8.1 as a Company App. The application I have developed is using a Visual Studio Apache Cordova Apps project, but I've also tested a manually created .appx, a Blank App (Universal Windows 8.1) and a Blank App (Windows Phone)... the last two seem to effectively be the same project type, the Universal one is just in a Solution with a Windows 8.1 project in as well.

I always get the error message detailed below when I try and install it (tried variously from email, web and the phone's local folders.

Installing a C# Windows Phone 8.1 Hub App project works perfectly using the same workflow.


Error Message

Can't install company app

There's a problem with this company app. Contact your company's support person for help


Dev Environment


Working Project Types


Erroring Project Types


Workflow

Upvotes: 13

Views: 3450

Answers (1)

Klors
Klors

Reputation: 2674

The answer, when it came, is pretty simple, if not very obvious. Microsoft have said

In Windows Phone 8.1 there is a known issue that required enterprise appx packages to have this [CodeIntegrity.cat] file.

There is actually a small clue in the page on Troubleshooting packaging, deployment, and query of Windows Store apps in the section for APPX_E_MISSING_REQUIRED_FILE (though you don't actually get this error code when deploying a signed Company App and so it's not really a clue in this case). It states -

The package isn't valid because it's missing a manifest or block map, or a code integrity file is present but a signature file is missing.

Ensure that the package isn't missing one or more of these required files:

\AppxManifest.xml

\AppxBlockMap.xml

If the package contains \AppxMetadata\CodeIntegrity.cat, it must also contain \AppxSignature.p7x.

What it doesn't say is that (at least for me) the reverse is also true.

If you're signing a Company App, which inserts an AppxSignature.p7x file, then you must also have an \AppxMetadata\CodeIntegrity.catfile in your .appx package. This is only generated if you have a dll in your project and, on Windows Phone 8.1, hybrid apps can be written quite easily without ever needing any dlls.

So I created a blank Class Library (Portable for Universal Windows 8.1) project, built an empty dll and inserted it into the root of the solution created by building the Cordova app. I also removed the dependency to WinJS 2.1 as this can stop the app from installing as a company app and the WinJS files are already in my project (the dependencies can't be pushed to a device when installing as a company app, they can if they're being deployed from the Windows Store or from Visual Studio).

Choosing "Store > Create App Packages..." now produces an .appx file with a dll in the root and now when I run it through the BuildMDILAPPX.ps1 script a \AppxMetadata\CodeIntegrity.cat is created for the package.

Installing this package now works and installs successfully.

Upvotes: 5

Related Questions