![1. Implementing CustomActions in WiX: Integrating CustomActionData Seamlessly](https://thmb.techidaily.com/d9427c61032284cb88ab156d6c103f9d31f7d2686f689f4e79141572fa04ae5d.jpg)
1. Implementing CustomActions in WiX: Integrating CustomActionData Seamlessly
![](/images/site-logo.png)
1. Implementing CustomActions in WiX: Integrating CustomActionData Seamlessly
Inno Setup
WiX Toolset
InstallShield
MSIX Packaging Tool
Check your inbox and confirm the
subscription
Exclusive Newsletter
Exclusive Newsletter
Get the latest WiX insights direct to your inbox. Subscribe now!
Disclaimer: This post includes affiliate links
If you click on a link and make a purchase, I may receive a commission at no extra cost to you.
How to pass CustomActionData to a CustomAction using WiX
Written by Horatiu Vladasel · September 9th, 2022
Do you want to transfer CustomActionData to a CustomAction in WiX? We’ll show you how in this article.
When adding CustomActions using WiX, there are two elements that you need to use:
- the CustomAction element;
- the Sequence element.
The CustomAction element specifies the custom action that will be added to the MSI CustomAction table.
On the other hand, the Sequence element is used to schedule the CustomAction within the corresponding table (AdminExecuteSequence, AdminUISequence, AdvertiseExecuteSequence, InstallExecuteSequence) and set any condition, if needed.
Each condition is evaluated separately, and the corresponding CustomAction is run only if the condition is set as True. Otherwise, the CustomAction gets skipped. If the condition syntax is invalid, then the sequence ends and returns iesBadActionData.
Get more details about WiX CustomActions from our How To Add Custom Actions in WiX Toolset article.
What is the challenge when you want to pass a property to a Deferred CustomAction?
A Deferred CustomAction doesn’t have any information about the original session handle and property data (Session.Property([PROPERTY])). This is because the script generated for it is executed outside of the installation process. Instead, you will need to use CustomActionData (Session.Property(“CustomActionData”)) .
How to use CustomActions with WiX?
Let’s suppose we need to add a script that takes the value of the SERVERPATH property as an input (passed to the installer via command line) and writes it into the registry. The CustomAction script should look like the one below:
First, we must define our CustomAction elements:
Copy
Let’s understand what SetServerPathProperty and SetServerPath CustomAction are:
- The SetServerPath CustomAction is the Deferred CustomAction and it references the VBScript defined above, which is stored in the Binary table.
- The SetServerPathProperty is the SetProperty CustomAction which is used to set the property of interest (SERVERPATH) property to a property with the same name as the Deferred CustomAction (SetServerPath).
We also need to define the Binary element because the VBScript referenced by the SetServerPath CustomAction is stored in the Binary table.
Copy
Once the CustomAction and Binary elements are defined, we can set the corresponding InstallExecuteSequence elements – one for each of the two CustomActions.
Copy
When scheduling the two CustomAction in the InstallExecuteSequence table, the SetProperty CustomAction (‘SetServerPathProperty) should be scheduled before the Deferred CustomAction (SetServerPath).
SetProperty CustomAction (‘SetServerPathProperty) is used to set the property of interest to a property with the same name as the Deferred CustomAction.
The complete listing for the WiX source file (.wxs) should look like the one below:
Copy
Now, all we need to do is to:
- Pre-process and compile the WiX source file into a WiX object file.
- Process the WiX object file compiled previously and build the Windows Installer (MSI package).
How to configure CustomActions with Advanced Installer?
If you use Advanced Installer to build and create your MSI, there is no need for an extra CustomAction to set the property of interest with the same name as the Deferred CustomAction.
All you need to do is specify the value of the CustomActionData property within the “ActionData” and Advanced Installer does the rest for you.
Have a look at our How to Use CustomActionData to Access Windows Installer Properties in Deferred CustomActions article to find out more about:- Why do you need CustomActionData- When can Deferred CustomActions go wrong- How you can pass CustomActionData to a CustomAction using Advanced Installer
Conclusion
WiX does not have a GUI and it builds the Windows Installer packages based solely on the information defined within the WiX source file (wxs). This makes it difficult to use, especially for people who have little or no experience.
On the other hand, Advanced Installer comes with a dedicated GUI for adding a CustomAction and passing the CustomActionData property to it which makes the job a lot easier and very intuitive.
Try out Advanced Installer’s dedicated GUI for CustomAction through our 30-day full feature trial .
Advanced Installer #1 alternative to the WiX Toolset
We decided to focus on our main goal to save precious time of our developers.
HANS-LEO TEULINGS
PHD – CEO, NEUROSCRIPT, LLC
You might find useful:
- CAB Embedding Options in MSI
- Updated installers in WiX Toolset
- Custom Actions In WiX Toolset
- Windows Services with WiX Installer
- Set WiX Installer Version to the Current Build Version
- Remove Files and Folders when Uninstalling with WiX
- How to set a WiX Toolset custom action to run only on uninstall
- How to create non-advertised shortcuts for all users / per machine with WiX Toolset
- How to Remove Files on Uninstall Using WiX Toolset
- How to create major upgrades for MSI packages using WiX Toolset
- How to pass CustomActionData to a CustomAction using WiX
- How to build an installer without a license page using WiX Toolset
- How to create a WiX KeyPath attribute
- How to Create a Desktop Shortcut using WiX Toolset
- How to Use WiX MSI to Update an Installed Application
- How to correctly set the install folder in Wix
- WiX Toolset Visual Studio Extension
- How to create a custom dialog in WiX for user input
- How to create an MSI installer with WiX
- How to use WIX MSI to do a silent install or uninstall of a web app
Get the most from packaging with Advanced Installer
Try the 30-day fully-featured edition absolutely free!
No credit card required
Also read:
- [New] Step-by-Step Guide IPhone Picture Perfection
- 2024 Approved Unleashing Creativity in Instagram Photography Through Border Use
- ASROCK's Stunning 32 OLED Display with Enhanced Color at 480Hz: A Visual Delight and Network Companion
- Enhanced User Experience with Dynamic Content: Powered by Cookiebot
- Establishing Trustworthiness Through Identification Verification in the Digital Era of Banking
- Evolution of ABBYY: Embracing a New Identity with an Emphasis on Organizational Growth and Personnel Empowerment
- Future Leaders Expect More Process Clarity and Innovative Tech, Reveals ABBYY Research on WFH Adaptations
- Get Siri Back On Track: Essential Tips and Tricks for iPhones & iPads
- How to Repair Broken video files of Huawei P60 Pro?
- In-Depth Analysis Navigating Zoom for Webinars and Livestreams for 2024
- Is Genuine Consumer-Centric Approach Now at the Forefront of Insurance Claims?
- Leverage Advanced Traffic Insights: The Power of Cookiebot Technology on Websites
- Step-by-Step Guide: Why Your PC Can't Exit Windows 11 Properly and How to Fix It
- Win 11: Tackle Icons Not Aligned
- Title: 1. Implementing CustomActions in WiX: Integrating CustomActionData Seamlessly
- Author: Donald
- Created at : 2024-09-27 17:26:10
- Updated at : 2024-10-03 19:08:29
- Link: https://some-tips.techidaily.com/1-implementing-customactions-in-wix-integrating-customactiondata-seamlessly/
- License: This work is licensed under CC BY-NC-SA 4.0.