I have seen questions pop up fairly frequently both on internal Microsoft mailing lists and on the WiX mailing lists on SourceForge about how to use the built-in custom actions included in extension DLLs in WiX v3.0.
This is one of the big changes that folks notice when they migrate any existing setup authoring from WiX v2.0 to WiX v3.0. The built-in custom actions used to ship in libraries like wixca.wixlib, wixui.wixlib, sca.wixlib, etc in WiX v2.0, but those files are no longer shipped directly as a part of WiX v3.0. Instead, they are embedded into extension DLLs. The extension DLLs in WiX v3.0 include such things as the WixUI dialog library, the IIS custom actions, server custom actions, system information custom actions, etc.
I pulled together some answers to this type of question from Justin Rockwood and a couple of other folks and created a new topic in the v3.0 wix.chm file (starting in build 3.0.3419.0) that introduces how to use extensions in your WiX 3.0 authoring and build process. Justin had a great idea to post this topic on his blog, and so I figured I’d post it on mine as well in order to help improve discoverability via search engines, etc.
Using extensions when calling WiX tools via the command line
To use a WiX v3.0 extension when calling the WiX tools directly, you need to use the -ext command line parameter available in the Candle, Light and Lit tools and pass in the extension DLL(s) needed for your project. Each extension DLL must be passed in via separate -ext parameters. For example:
light.exe MySetup.wixobj -ext “c:\Program Files\Windows Installer XML v3\bin\WixUIExtension.dll” -ext “c:\Program Files\Windows Installer XML v3\bin\WixUtilExtension.dll” -out MySetup.msi
Using extensions when building an MSI in Votive
To use a WiX v3.0 extension when building in Visual Studio with the Votive add-in, you can use the following steps:
- Right-click on the WiX project in the Visual Studio solution explorer and select Add Reference…
- In the Add WiX Library Reference dialog, click on the Browse tab and browse to the WiX extension DLL that you want to include.
- Click the Add button to add a reference to the chosen extension DLL.
- Browse and add other extension DLLs as needed.
After you have added a reference to an extension DLL, Votive will automatically add the appropriate -ext command line switches when it calls Candle, Light and/or Lit.
Enabling IntelliSense for extensions in the VS IDE
To enable IntelliSense for a WiX extension in the Visual Studio IDE, you must also add an XMLNS declaration to the <Wix> element in your WXS file. For example, if you want to use the NativeImage functionality in the WixNetFxExtension, you can use a <Wix> element that looks like the following:
After adding this, you can add an element named <netfx:NativeImage/> and view IntelliSense for the attributes supported by the NativeImage element.