Dienstag, 19. Februar 2013

BURN #01: Get the BootstrapperApplicationData.xml

This one is not tricky at all. You basically want to get this data if your installer is running, to get the dependencies of the .msi packages right.
Now, there's no example from wix.sourcefourge.com, nor from anywhere else I searched.

This code in your BootstrapperApplication UX (user experience) gets you the file.
    string fileName = "BootstrapperApplicationData.xml"; 
    string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), fileName); 
    using (FileStream stream = new FileStream(path, FileMode.Open)) 
    { 
        ... 
    }

If you want to have this file without running your installer: don't go starting it and searching for the file. That'd suck. No, just go to cmd, and run:
%WiX%\bin\dark.exe <your_file> -x <extract_to_this_dir>

So, how to get custom data in there?
It's a bit fuzzy at the moment, but Rob Mensching said:
You just add rows to a table that has BootstrapperApplicationData="yes". The Binder will translate all those rows into BootstrapperApplicationData.xml.
-----------------------
First, the CustomTable definition (just Column elements) can be put in a separate Fragment. Then, when you populate a CustomTable (add Row elements) that CustomTable will reference the definition.That means you need to put the CustomTable/Row in a fragment that is referenced. 
Often, the CustomTable/Row data is so verbose, there is a tendency to put it in a separate Fragment. That is a completely reasonable but now it's floating in an island that needs a "hackish" reference. Empty PayloadGroup for Bundles is very good, BTW.
So what's the ideal?  The ideal is to create an Extension. The Extension would then extend the compiler to provide a "pretty face" on your CustomTable and be far more powerful than the raw Row elements. 
We cheated for a long time with the wixstdba by using WixVariables before finally creating the "pretty face". Looking back, we should have done it earlier. <smile/> 

Keine Kommentare:

Kommentar veröffentlichen