To quote RobMen on stackoverflow: "You might take a look at the extensions in 
the WiX contrib (http://wixcontrib.codeplex.com/) project. Since they aren't 
part of the WiX toolset they have the extra steps needed to build the 
extension."
 
The WixExtension is required in most wix extensions and supplies the 
CompilerExtension for candle's compiler to use to process your code. If you 
also provide any wixlibs in your extension, the WixExtension supplies those as 
well. DecompilerExtension is used by dark.exe to convert the MSI back into 
source code that will use your extension. It isn't required but it is helpful.
 
The your-extemsion.xsd is used to validate code using your schema is valid (if 
that setting is enabled) and can also used to generate the help files (if you 
wish to go that far requires a tool built when building the toolset). Another 
tool built in the toolset build is used to create classes used by your 
DecompilerExtension. You can copy yours into VS's schema folder (Wix's xsd 
files are copied to that folder by the Wix installer).
 
The tables.xml is parsed to generate the table definitions for your custom 
tables and is supplied through the WixExtension. There are helper methods on 
the *Extension classes to help you implement several of these (see how they are 
used in the extension code you evaluate.
 
The messages.xml is used to separate text from code (to enable toolset 
localization in the future) but isn't required to write your own extension. It 
requires a tool built when building the toolset to generate code to cause the 
error and warnings to be visible to the rest of the code.
 
Override ParseElement in your CompilerExtension to parse your Foo element. The 
convention in the Wix extensions is to have ParseElement call ParseFooElement 
if an element named Foo is found. ParseFooElement would then create a Row 
object of your Foo table similar to the way the extensions you have examined do.
 
The content in the "contextValues" argument to ParseElement will depend on the 
parent element that calls you. Look up the appropriate code in Compiler.cs in 
the wix sources under src\wix to see what is present (and in what order) for 
each of your parent elements.
 
Hopefully this rambling message has enough nuggets to get you going. Please 
contribute back a CompilerExtension section for the help, that would be greatly 
appreciated.
 
Blair Murri
 
> From: john.ludlow...@gmail.com
> Date: Wed, 19 Jun 2013 15:44:04 +0100
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] Wix CompilerExtension documentation and tutorial?
> 
> Hi all,
> 
> We have a custom action which processes rows in a custom table (the details
> of this don't matter, but suffice to say some code is run for each record).
> Currently we are using a CustomTable element in our wxs to implement this,
> and I think we could do better with a WiX extension. I want to write an
> extension that provides new <foo:Foo/> elements in the schema and causes
> data based on <foo:Foo/> elements in my source to be written to a Foo table.
> 
> I've been looking at this today, but the documentation is lacking. For
> starters, there are different types of extensions. I've played a
> little with BinderExtension in the past, and I think the best choice here
> is a CompilerExtension, but there's nowhere in the documentation which lays
> this out.
> 
> More importantly, the kind of code you need to write to create an extension
> isn't explained. I've taken a look at the code for the Util extension and
> the Gaming extension, and there seems to be a pattern of creating a
> CompilerExtension, a DecompilerExtension and a WixExtension (though I'm not
> sure what the point of the latter is). There also seems to be a table
> definitions XML file and a messages XML file, but no clear indication of
> how this is used.  The tables xsd doesn't seem to get installed when I
> install the toolset - is it safe to copy this into the Visual Studio
> schemas folder?
> 
> I checked out the docs at
> http://wix.sourceforge.net/manual-wix3/extension_development.htm and the
> tutorial at http://wix.tramontana.co.hu/tutorial but the tutorial doesn't
> mention anything about WiX (it may be slightly out of date with how
> prevalent extensions have become lately) and the official docs contain a
> sample on pre-processor extensions but not compiler extensions.
> 
> Is there a blog post or something out there with more a complete
> walkthrough of how to develop something like a compiler extension? And if
> there isn't but I manage to figure it out anyway, is there a way to capture
> that so it can be shared (e.g, could I submit a change to the doc with
> a CompilerExtension sample)?
> 
> I'm using Wix 3.6 at the moment
> 
> Thanks
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
                                          
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to