Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

  • Windows 8.1 Enterprise
  • Visual Studio Enterprise 2015 with Cross Platform Mobile Development > HTML/JavaScript (Apache Cordova) Update 1
  • Windows Enterprise Developer account with Symantec Code Signing Certificate for Windows® Phone Private Enterprise
  • Developer Unlocked Nokia Lumia 635 or Company MDM Enrolled Nokia Lumia 635

Working Project Types

  • Hub App (Windows Phone) [Templates > Visual C# > Windows > Windows 8 > Windows Phone]
  • presumably any other C# project type (not tested)

Erroring Project Types

  • Blank App (Apache Cordova) [Templates > Other Languages > TypeScript > Apache Cordova Apps]
  • Blank App (Universal Windows 8.1) [Templates > Other Languages > JavaScript > Windows > Windows 8 > Universal]
  • Blank App (Windows Phone) [Templates > Other Languages > JavaScript > Windows > Windows 8 > Windows Phone]
  • Manually created an appx with a single HTML file in, using an AppxManifest.xml base template from Microsoft and MakePri.exe, MakeApp.exe

Workflow

  • Create the relevant project type from Visual Studio
  • Alter the Phone.appxmanifest file to have the Publisher match the Symantec Certificate Subject and to have our PhonePublisherID
  • Right-click project, "Store > Create App Packages..."
  • Go through the wizard selecting "No" to Windows Store, to never bundle and build the Release version
  • Use either SignTool.exe or BuildMDILAPPX.ps1 to sign the package using our certificate
  • Install the AET.aetx file on the phone if it hasn't been already
  • Install the application on the phone (from email, web or local folder)
  • Error
like image 511
Klors Avatar asked Aug 05 '15 15:08

Klors


People also ask

How do I manually install apps on my Windows phone?

In the App list, tap Store. Tap More, and then tap Install local apps. Select the apps you want, and then tap Install.

Does Microsoft Store still work on Windows Phone?

The Windows Phone Store officially shuts down today (via Neowin). Following the shutdown, you will no longer be able to download apps from the store. Windows Phone 8.1 has been out of official support for well over a year, but the shut down of the Windows Phone Store kills the operating system off even more.


1 Answers

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.

like image 137
Klors Avatar answered Sep 28 '22 02:09

Klors