Custom Actions
The customActions object is a container for six different kinds of custom actions:
"msi": {
"customActions": {
"exe": [ … ], // run an executable
"dll": [ … ], // call a function in a DLL
"registerDll": [ … ], // regsvr32 a DLL
"powershell": [ … ], // run a .ps1 script (embedded into MSI)
"installDriver": [ … ], // install a driver from .inf
"setProperty": [ … ] // set an MSI property at runtime ★ NEW in 2.2.0
}
}
Common properties
All custom-action types share these common properties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | – | Unique name within the package. |
condition | string | no | – | MSI conditional expression that gates the action. |
sequence | string | no | EndOfExecution | StartOfExecution, EndOfExecution, or any short int (-32768 to 32767). |
continueOnError | boolean | no | false | If true, install proceeds when the action errors. |
Common conditions
| Goal | Condition |
|---|---|
| Always | null |
| Only during install | NOT Installed |
| Only during repair | Installed AND NOT REMOVE |
| Only during uninstall | REMOVE~="ALL" |
| Only during Windows 11 | (VersionNT = 1100 AND MsiNTProductType = 1) |
| Only during x64 OS | VersionNT64 |
| Only during x86 OS | NOT VersionNT64 |
Full grammar: Microsoft's Conditional Statement Syntax.
exe – run an executable
| Property | Type | Required | Description |
|---|---|---|---|
name | string | yes | Action name. |
filePath | string | yes | Path to the executable. Validated as a syntactically valid path. Can be a path inside the package. |
arguments | string | no | Arguments. |
condition, sequence, continueOnError | – | no | See common. |
{
"exe": [
{
"name": "PostInstallSetup",
"filePath": "$.installDir\\My Application.Setup.exe",
"arguments": "--silent --first-run --language [LANGUAGE]",
"condition": "NOT Installed",
"sequence": "EndOfExecution"
}
]
}
dll – call a function in a DLL
| Property | Type | Required | Description |
|---|---|---|---|
name | string | yes | Action name. |
filePath | string | yes | Path on disk at build time to the DLL (its bytes are embedded into the MSI). |
entryPoint | string | no | Name of the exported function to call. |
arguments | string | no | Arguments. |
condition, sequence, continueOnError | – | no | See common. |
{
"dll": [
{
"name": "My ApplicationPostInstall",
"filePath": "ca\\My Application.CustomActions.dll",
"entryPoint": "PostInstall"
}
]
}
registerDll – regsvr32 a DLL
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
filePath | string | yes | – | DLL inside the package (validated against fileSystemEntries). |
unregisterOnUninstall | boolean | no | true | Whether to regsvr32 /u on uninstall. |
{
"registerDll": [
{ "filePath": "$.installDir\\My CompanyShellExt.dll" }
]
}
powershell – run a .ps1 script
| Property | Type | Required | Description |
|---|---|---|---|
filePath | string | yes | Path on disk at build time to the .ps1 (its content is embedded into the MSI). |
condition, sequence, continueOnError | – | no | See common. |
{
"powershell": [
{
"filePath": "ca\\InitializeDatabase.ps1",
"condition": "NOT Installed",
"sequence": "EndOfExecution"
}
]
}
installDriver – install a driver from .inf
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
filePath | string | yes | – | .inf path inside the package. |
importCertificate | boolean | no | false | Import the driver's signing certificate to TrustedPublishers before install. |
removeOnUninstall | boolean | no | true | Uninstall the driver when the package is uninstalled. |
{
"installDriver": [
{
"filePath": "$.installDir\\drivers\\My CompanyUSB.inf",
"importCertificate": true
}
]
}
setProperty – set an MSI property at runtime ★ NEW in 2.2.0
Use this to compute a property value conditionally during install. It is the safe modern way to gate other custom actions.
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
propertyName | string | yes | – | Property name to set. |
propertyValue | string | yes | – | Value to set (supports [Property] substitution). |
condition, sequence, continueOnError | – | no | Default sequence is StartOfExecution. |
{
"setProperty": [
{
"propertyName": "INSTALL_TIER",
"propertyValue": "Enterprise",
"condition": "Privileged"
},
{
"propertyName": "INSTALL_TIER",
"propertyValue": "Standard",
"condition": "NOT Privileged"
}
]
}
Validation
unique custom action name– everynameacrossexe,dll,powershellmust be unique.