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

1

13

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
Lamellate answered 5/8, 2015 at 15:47 Comment(0)
L
5

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.

Lamellate answered 25/8, 2015 at 13:6 Comment(9)
This is great information! Thanks for the write-up. I'm going to test this soon. On another note, how was your experience using Visual Studio 2015, & Cordova for a company app? Would you recommend it or suggest other solutions? Thanks!Dike
@Dike thanks. VS 2015 with Cordova is a great fit for me coming from a web development background. 2015 Cordova integration is a lot improved from the 2013 CTP version. Using it with WinJS 4 gives a very convincing app experience, though it does feel like WinJS makes some things harder than they need to be. A native app will still give you a better overall app, but as a way to quickly get into Windows Phone 8.1 apps, it's excellent.Lamellate
Agreed. VS2015 is a big improvement over VS2013. Cordova integration has been good although I've run into some problems that have taken days to fix. TypeScript has been a huge plus when working with VS2015 and Cordova. I researched WinJS not long ago, but wasn't happy with touch support across devices. I'll check it out again. Multi-hybrid development is the way to go for so many reasons. Cordova + VS2015 + TypeScript is the best productive mobile/web development solution. Add AngularJS, Ionic, React, etc. and I think it's a real development approach for all devices.Dike
I placed the DLL file in the root of the project and the app metadata is not created with the \AppxMetadata\CodeIntegrity.cat file. Can you specify clearly where this file needs to be added?Nordin
@Nordin When you build the main Cordova solution in Visual Studio it will create another solution within the platforms > windows folder (this may be a hidden folder, I forget). You need to open that solution in Visual Studio and add the DLL to the root of the relevant project before you build.Lamellate
Thanks. It created an .appx bundle file containing an .appx file, inside which the missing files were located. Is it OK that it created an .appx bundle file as opposed to just an .appx file?Nordin
The bundle file is supported by the Windows Store and Intune, but it isn't by XenMobile, so depends on your MDM/MAM. I can't recall if I tried distributing a bundle directly via website download and AET. However, the bundle is produced because it supports partial updates to apps and it's detected that it is not the first time you've built that app, I did manage to get the build process to produce an appx on the very first time it was built though, so perhaps clearing the build folders for the sub-solution might help produce an appx instead of a bundle? Best ask that in another question though.Lamellate
The options I am looking at are either via email, web server or Windows Store (Enterprise associations). I tried placing the file in the device's local drive which seemed to work.Nordin
I think if you could install it from the local drive, then it should work from elsewhere.Lamellate

© 2022 - 2024 — McMap. All rights reserved.