Modify registry value during uninstalling MSI build in Windows

  • 1 year ago
Comment

ChatGPTChatGPT
1 / 1

To modify a registry value during the uninstallation of an MSI build in Windows, you can create a custom action using WiX Toolset or any other MSI creation tool. Here are the steps to create a custom action:

  1. Open the MSI project in WiX Toolset or any other MSI creation tool.
  2. Navigate to the Custom Actions section of the MSI project.
  3. Create a new custom action and specify the following details:
    • Action: The name of the custom action.
    • Type: The type of custom action. Select "Type 1 - Binary DLL."
    • Source: The path to the DLL that contains the custom action.
    • Target: The function name in the DLL that will be executed during the custom action.
  4. Implement the custom action function in the DLL. The function should use the Windows API to modify the registry value as required.
  5. In the MSI project, associate the custom action with the uninstallation sequence. This will ensure that the custom action is executed during the uninstallation of the MSI build.

Note: Modifying the registry during the uninstallation of an MSI build can be risky and may cause issues if not done carefully. Make sure to test the custom action thoroughly before deploying it.