-
Notifications
You must be signed in to change notification settings - Fork 93
Create Custom Package
ikas edited this page Sep 29, 2024
·
7 revisions
Modify the package, then repackage and sign it
- Tools, use Microsoft's official MSIX Packaging Tool
- Certificate for signing, create a self-signed certificate
- Package to be modified, use ContextMenuCustom-CMC_ANY-X
Download and install MSIX Packaging Tool https://learn.microsoft.com/en-us/windows/msix/packaging-tool/package-editor
ContextMenuCustom-CMC_ANY-XXX
Min Version : 5.0.0.0
Download form github release or github actions
detail: https://learn.microsoft.com/en-us/windows/msix/package/create-certificate-package-signing
create certificate
#-Subject "CN=CMC-DEV"
#-FriendlyName "cmc-dev"
New-SelfSignedCertificate -Type Custom -Subject "CN=CMC-DEV" -KeyUsage DigitalSignature -FriendlyName "cmc-dev" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")
output
Thumbprint Subject
---------- -------
79F6CCA60D36A57C8672197D0DA0B6071A40AEB0 CN=CMC-DEV
export certificate as pfx
# -String xxxxxxxxxx password
# -cert Cert:\CurrentUser\My\{Thumbprint} Thumbprint
# -FilePath f:/test.pfx path
$password = ConvertTo-SecureString -String xxxxxxxxxx -Force -AsPlainText
Export-PfxCertificate -cert "Cert:\CurrentUser\My\79F6CCA60D36A57C8672197D0DA0B6071A40AEB0" -FilePath f:/test.pfx -Password $password
- Open
MSIX Packaging Tool
,ClickPackage editor
- Select ContextMenuCustom-CMC_ANY-XXX ,Then Click
Open
-
Signing preference
,Selectsign with a cert(.pfx)
, select pfx file -
Manifest file
ClickOpen file
, Will open Manifest file, we need modify it (See below for details) - Change
Version
, plus 1
<?xml version="1.0" encoding="utf-8"?>
<Package >
<!-- 1. Name : uuid, must be unique -->
<Identity Name="852637cb-5c5e-4695-93cd-d2b0ca79f6de" Publisher="CN=CMC-DEV" Version="5.0.5.0" />
<Properties>
<!-- 2. DisplayName PublisherDisplayName-->
<DisplayName>Custom Context Menu (Any)</DisplayName>
<PublisherDisplayName>touchwp</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Applications>
<Application Id="App">
<!-- 3. DisplayName PublisherDisplayName -->
<uap:VisualElements
DisplayName="Custom Context Menu (Any)"
Description="Custom Context Menu (Any) For Win11"
/>
</uap:VisualElements>
<Extensions>
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<!-- 4. Clsid 9DD7188B-41FA-4C01-BFB2-F82DC1521DAD must be unique -->
<desktop5:ItemType Type="Directory" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
<desktop5:ItemType Type=".png" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
<desktop5:ItemType Type=".jpeg" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="Custome Context Menu (Any)">
<!-- 5. Id 9DD7188B-41FA-4C01-BFB2-F82DC1521DAD must same as 4 -->
<com:Class Id="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" Path="ContextMenuCustomHost.dll" ThreadingModel="STA"/>
</com:SurrogateServer>
</com:ComServer>
</com:Extension>
</Extensions>
</Application>
</Applications>
</Package>
Name="852637cb-5c5e-4695-93cd-d2b0ca79f6de" Replace with a new guid
Clsid 9DD7188B-41FA-4C01-BFB2-F82DC1521DA, Replace with a new guid
support *, .xxx, Directory, Directory\Background
<desktop5:ItemType Type="Directory" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
<desktop5:ItemType Type=".png" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>
<desktop5:ItemType Type=".jpeg" >
<desktop5:Verb Id="CustomMenu" Clsid="9DD7188B-41FA-4C01-BFB2-F82DC1521DAD" />
</desktop5:ItemType>