问题
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
回答1:
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.cat
file 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 dll
s.
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.
来源:https://stackoverflow.com/questions/31837144/windows-phone-8-1-html-company-apps-cant-install-company-app