Packging of Edge Extension which support nativemes

2019-08-04 19:38发布

问题:

I developed an extension which uses native messaging to communicate with backend uwp application. How can I package it?

When I install the package, will it install the edge extension as well which is a part of the package.

回答1:

I have successfully built a package with the edge extension by the following steps. Hope this will help you~

Build the project as following structure in C\EdgeExtension\Appx:

1. fullTrustProcess
If there is fullTrustProcess, the exe should be included in TrustedProcess folder, with configuration in AppxManifest.xml.

<desktop:Extension Category="windows.fullTrustProcess" Executable="TrustedProcess\MyTrustedProcess.exe" />

If there is no fullTrustProcess, ignore and delete the TrustedProcess folder.
2. Extension
JS files of Edge extension are included in Extension folder, configured as following: 3. UWP files
- Assets
- AppxManifest.xml
- EdgeNativeMessage.dll
- EdgeNativeMessage.exe
- EdgeNativeMessage.winmd
- resources.pri
4. Package with command

    C:\Program Files (x86)\Windows Kits\10\bin\x86\makeappx.exe pack /h SHA256 /d  C\EdgeExtension\Appx /p C\EdgeExtension\EdgeNativeMessage.appx
5. Sign the appx

    C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe sign /fd SHA256 /a /f C:\EdgeExtension\MyKey.pfx /p "password" C\EdgeExtension\EdgeNativeMessage.appx
  1. Install Extension
    • install the MyKey.pfx
    • double click MyEdgeExtension.appx, then click install to install the extension.
  2. Check
    • launch Edge broser
    • click ...-> Extensions,
      System will register the appx, it needs several seconds before the extension shows in the extension list.
    • check registry
      The EdgeNativeMessage will add to the two path.

    Computer\HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Extensions
Computer\HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ExtensionsStore\datastore\Config