Welcome to MSDN Blogs Sign in | Join | Help

WiX: Writing Your Own WiX Extension Part 1

Wix extensions are used to extend and customize what WiX builds and how it builds it. I plan on talking about the 3 most common types of extensions in this article series; ProprocessorExtension, CompilerExtension, and BinderExtension.

The first step in creating any set of extensions is to create a class that implements WixExtension. This class will be the container for all the extensions you plan on implementing.

Creating a bare-bones WixExtension

1. Create a new C# library (.dll) project named SampleWixExtension
2. Add a reference to wix.dll to your project
3. Add a using statement: using Microsoft.Tools.WindowsInstallerXml;
4. Make your SampleWixExtension class inherit from WixExtension.

 public class SampleWixExtension : WixExtension {}

5. Add the AssemblyDefaultWixExtensionAttribute to your AssemblyInfo.cs.

 [assembly: AssemblyDefaultWixExtension(typeof(SampleWixExtension.SampleWixExtension))]

6. Build

7. Although it wont do anything yet, you can now pass the your SampleWixExtension.dll on the command line to the candle and light with the -ext flag like this:  candle Product.wxs -ext SampleWixExtension.dll

The next article in this series will explain how to add a Preprocessor extension to your WixExtension.

Published Friday, November 02, 2007 3:24 PM by Petermarcu
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Doctor Deploys Blog :: WiX: Writing Your Own WiX Extension Part 1

# re: WiX: Writing Your Own WiX Extension Part 1

Hi,

Nice work, but can you tell how to create an extension DLL written in VC++?

Is there a simple way for this or do I have to write a wrapper to do this?

Regards,

Albert van Peppen

Thursday, November 22, 2007 3:44 AM by apms

# re: WiX: Writing Your Own WiX Extension Part 1

Extensions need to me managed assemblies. You can interop with native code all you want inside the extension.

Thursday, November 22, 2007 4:37 PM by Petermarcu

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker