Context menu
Add a right-click "Open with…" entry in Explorer for files, directories, or directory backgrounds.
Applies to: MSI and MSIX.
contextMenufor MSI requiresdigitalSignature. Under the hood MPDEV deploys a tiny sparse MSIX that gives your Win32 app the identity Windows needs for context menu extensions, and that sparse package must be signed. See Digital Signature for signing setup.
contextMenu – right-click integration
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
fileType | enum | yes | – | One of * (any file), Directory, Directory\\Background. NEW in 2.2.0 – previously a free string. |
executable | string | yes | – | Exe to invoke when the menu item is clicked. |
name | string | yes | – | Display text in the right-click menu. |
icon | string | no | – | Existing path on the target system (post-install). Use $.installDir\… to reference the installed exe. Supported: .ico, .exe, .dll. |
arguments | string | no | "%1" | Arguments passed to the exe. Use %1 to receive the selected path. |
condition | string | no | – | Regex evaluated against the selected file/folder path to decide visibility. |
note
fileType values:
*– any file.Directory– right-click on a folder.Directory\Background– right-click on the empty area inside a folder.
Examples
"Open with My Application" on any file
"contextMenu": [
{
"fileType": "*",
"executable": "$.installDir\\MyApp.exe",
"name": "Open with My Application",
"icon": "$.installDir\\MyApp.exe",
"arguments": "\"%1\""
}
]
Right-click a folder to open it in My Application
{
"fileType": "Directory",
"executable": "$.installDir\\MyApp.exe",
"name": "Open folder in My Application",
"arguments": "--folder \"%1\""
}
Right-click in the empty area of Explorer
{
"fileType": "Directory\\Background",
"executable": "$.installDir\\MyApp.exe",
"name": "New My Company Note here",
"arguments": "--new \"%V\""
}
%V(capital V) is the Windows shell token for the current directory when invoked on a directory background.
Conditionally show only for .txt files
{
"fileType": "*",
"executable": "$.installDir\\MyApp.exe",
"name": "Convert TXT to My Company Note",
"arguments": "--convert \"%1\"",
"condition": "(?i)\\.txt$"
}
The condition is a regex matched against the selected item's path.
MSI vs MSIX behavior
| Aspect | MSI | MSIX |
|---|---|---|
contextMenu | Requires digitalSignature. Implemented as a sparse MSIX overlay that gives your Win32 app identity. | Declared in the MSIX manifest extensions. Always works. |
condition regex | Honored at shell extension load time. | Honored. |
Validation rules
| Validator | Catch |
|---|---|
required | fileType, executable, name are mandatory. |
valid path | executable and icon must be syntactically valid paths. |
valid value | contextMenu.fileType must be one of *, Directory, Directory\\Background. |
digital signature required - context menu | contextMenu for MSI requires a digitalSignature block. |