CustomInstallActions
The CustomInstallActions element contains all the definitions for what custom install actions are to be run and when they are to be run. You can only declare one instance of this element in your MicrosoftGame.config file. It has one required child element, Folder, which is a string that designates the folder containing all the files required for all custom actions. This folder can contain subfolders. You are responsible for ensuring that the package includes any dependencies of any custom action executables, and that these are in the appropriate load path for each one.When you package the title,
makepkg translates this CustomInstallActions element into the MSIX windows.customInstall extension in the generated appxmanifest.xml, where the equivalent element is <CustomInstall> with Folder expressed as an attribute. You don’t author that <CustomInstall> form yourself - in MicrosoftGame.config, Folder is a child element of CustomInstallActions, as shown in the Game config file changes examples later in this article.You must not put any of the primary game executables or other files into the designated Folder. It’s explicitly only for custom install files.
Action types
The three child nodes of the custom installation extension dictate when certain custom actions are run. There are three types of custom installation actions.- Install action: Actions the platform runs prior to the first startup of the app
- Repair action: Actions that are run when the user selects Repair or Reset
- Uninstall action: Actions that are run when the user uninstalls the app
Despite the name, an install action does not run when the package is installed. Each action type runs at a specific point in the app’s lifecycle, and an InstallAction runs once, immediately before the first launch of the title (this is the first point at which the platform can present the required UAC prompt). “Install”, “Repair”, and “Uninstall” name the lifecycle category the action belongs to - not the moment it runs. If you need work performed at actual package install/download time, custom install actions are not the mechanism. See Custom action usage for the full sequence.
The Uninstall action will only be run if an Install or Repair action has been run. The system uses the Name property to track this state. For this reason, it is important that the Install/Repair/Uninstall actions have the same Name.
Parts of an action
File
For each action, you must specify the file to run, and this file must be in your package. If you specify a path, it will be implicitly relative to your CustomInstallActions Folder path. You can’t specify an absolute path. Your path must not start with a backslash (\).Name
You must specify a Name for the action. This Name must be unique within the parent Actions node, but can be shared across different Actions nodes. For example, you might specify File=“MySetup.exe” and Name=“abc123” as both an InstallAction and a RepairAction. On the other hand, if you have two InstallAction elements, they each must have a different Name. You should use the same Name for the same executable across package versions so long as that executable doesn’t change. The Name is used as the identity of the action, and allows the platform to track which actions have been successfully run, and whether they need to be run for an updated package. If an updated package specifies a custom action with a Name that has already been successfully run, the platform skips this action on update.A difference in the arguments list doesn’t constitute a difference in identity. If you want to run the same executable with different arguments in an updated package, you must supply a different Name. It’s your responsibility to configure your declared Names appropriately, and to track them across versions.
Arguments
Each custom installation action has a third element argument, which allows you to include any arguments you need included to run the redistributable command.Custom action usage
Installing anti-cheat software typically requires the user to have admin privileges, and in general - because custom actions is an extremely powerful feature - the platform requires admin privileges for any package that has custom actions. For operations that run with admin privileges, Windows requires a User Account Control (UAC) prompt to be shown on first run of the app. The user workflow is as follows.- The Microsoft Store page for the game includes a description of the requirements, including whether installation requires elevated privileges, whether the installation runs a custom action, and what this might mean to the user. This information is provided so that the user can make an informed decision about purchasing the game.
- Assuming the user is happy with the constraints and implications, they select Install.
- The platform detects that the package includes a custom action, and records the fact that the custom action needs to be run. However, it doesn’t run the custom action during the initial installation phase. Instead, any custom action is run the first time the user launches the game.
- On first launch of the game, at the point when the platform is about to run custom actions, it displays a UAC prompt. The user then needs to provide admin credentials and accept elevation. Even if a package contains multiple custom actions, the user is given only one UAC prompt. There’s no further UAC prompt for updates unless one or more of the custom actions has changed. There’s a UAC prompt when the game is uninstalled.
Custom install actions are only supported within the main MSIXVC package. They’re not supported in framework packages, optional packages, modification packages, or any other type of package.
Custom install, repair, and uninstall actions are executed by the retail Microsoft Store deployment pipeline. They aren’t run when you install the package locally for development - for example, when you install a loose
.msixvc by using wdApp install, or register a package by using Add-AppxPackage. A local development install still lets you verify that your package declares the actions correctly (they appear in the generated appxmanifest.xml as the windows.customInstall extension), but the custom action executables themselves aren’t invoked on that path. To validate the actions running end to end, install the title through a Store or sandbox flow.