Paraffin3.1: New and Improved!

Aren’t “New and Improved” the most over used, and contradictory, terms in the marketer’s dictionary? How can something and be new, but yet improved because if it is improved that cancels out the new. My point is that I want to tout an updated release of Paraffin, but I guess I’m being too much of an engineer instead of a marketer which is not a good idea when you something new and improved. Argh! I don’t think I’m helping myself here much. How about I express it this way; Paraffin has some improved things and some new things both of which I think users will greatly appreciate.

For those of you wondering what Paraffin does it’s a tool I wrote to help produce Windows Installer XML (WiX) fragments of files in your installations. The big feature of Paraffin is that is automates the management of your files because it keeps consistent the component ids and GUIDs as well as file and directory ids as you add files to your installer. Component GUID management is one of the biggest pain points on any WiX projects, especially those that have many files to install.

For background, I’ll refer you to the WiX 3.0 documentation, as well as the articles I wrote on the motivation behind Paraffin, Part 1, Part 2, and Part 3. Those articles were written for WiX 2.0, but I updated Paraffin with full to WiX 3.0 support back in December 2008 when WiX 3.0 went to Beta. Paraffin started out as just something that scratched my itch and gave me a chance to play with the brand new LINQ to XML stuff in Visual Studio 2008 Beta 2. It’s been gratifying how many people have told me they have used Paraffin and, even better, asked for feature enhancements. Keep those complaints and requests coming!

Many people have asked about the status of Paraffin now that WiX 3.0 has a much-improved Heat program that handles updating fragments. First off, I am thrilled that Brian Rogers is making Heat much more capable and useful. The WiX team as a whole has done an amazing job of making installers easier to write for mere mortals. Anything that can wrap the interesting API known as Windows Installer is always a good thing. With Heat now doing many of the things Paraffin does, and way more, if you’re in the planning stages of your install you need to seriously look at the whole WiX approach to auto generating fragments. The WiX developers are much smarter than I am and are thinking hard about how to solve these difficult problems. Paraffin meets my needs, and may meet yours, but definitely look at the Heat approach.

So let’s get on with the new and improved. In talking with several people that use Paraffin for their installs, I found that everyone wanted the -guids option, which told Paraffin to put in the GUIDs for components, to be on by default. That was a simple enough change, but if you are updating a file created with 3.0 and you didn’t want automatic GUIDs for components, I still respect that setting so you can add your GUIDs manually. I fixed a few other smaller things. The first was that I now do not include hidden files in the output. Also, I made all file and directory comparisons case insensitive to avoid Paraffin seeing the directory as different than what was previously processed on an update.

As I was working on the code, I decided to remove the option to upgrade your WiX 2.0 Paraffin produced files to WiX 3.0. As nearly everyone is now on WiX 3.0 and the conversion is a onetime operation, I probably am not upsetting too many people. Additionally, the conversion code was making development more complicated. If you’re still working with WiX 2.0, download Paraffin 1.04. If you need the conversion of WiX 2.0 Paraffin produced files to WiX 3.0, download Paraffin 3.0.

My original intent with Paraffin was a tool you would use to take directories of files you want to install and make that easy to maintain. My thinking was that you would do all your main INSTALLDIR portions manually. However, it turns out many, many, many people want to point Paraffin at all their files and essentially generate the fragment for everything under INSTALLDIR. The problem was that Paraffin 3.0 and prior would always insert the Directory element specified on the command line. Well, no more! <grin>. If you run the initial Paraffin run with the new -norootdirectory switch, Paraffin will start everything under the DirectoryRef element. That new and improved feature should make lots of people happy!

Looking at how Heat tackled the Component and File Id attributes problem was enlightening. Paraffin had originally used what I called a custom value, along with an incrementing counter to generate values for the Id attribute. That worked fine, but several people had reported that on very large projects, you could end up with Id collisions, which is not happiness in Windows Installer land. Heat is now using GUIDs for Id attributes, through a cool custom generation scheme. I decided to go a similar route, but since I did my updating based on filenames instead of directories, I felt it was safe enough to use normal GUIDs.

The downside is that you lose readability on the Id attributes when looking at Paraffin generated .WXS files. This will also affect WiX error message readability as well. However, I felt the tradeoff was worth it because you’ll never have to worry about Id attribute conflicts again and it allows me to introduce a new feature, which I’ll discuss in a second. I dropped the previous -custom switch in favor of -groupname to specify the Id attribute of the ComponentGroup. If you have scripts that call Paraffin, I redirect the -custom switch to -groupname. I’ve tried to keep backwards compatibility in mind.

For those of you like me who have a bunch of Paraffin produced files using Paraffin 3.0, what does this new Id attribute naming scheme mean when you update a file? Fortunately, nothing. I’ve introduced the concept of file versions in the comment where I store the file creation options. If the file is a Paraffin 3.0 file, it has no version so I use the old Id attribute-naming scheme for consistency. It wasn’t that hard to code and it keeps backwards compatibility. For all newly created Paraffin .WXS files, you obviously get file version 2 so I use the new GUID based scheme.

Andriy Volkov had a very interesting idea for a feature where Paraffin would look for specific files as it was recursing directories, and insert their contents into the current Directory element. That sounded like an excellent idea to me. This feature is what dictated changing the Id attribute scheme, as I wanted to avoid conflicts. With the file insertion capabilities now, you can put things like COM and service registration next the files themselves to make your installs more modular.

Paraffin looks for .ParaffinMold files, which are nothing more than WiX fragments. That way you have the full .XSD file magic when creating the files to avoid errors. What Paraffin looks for the DirectoryRef element in the .ParaffinMold file and inserts all child elements directly into the output file. Paraffin does not use the DirectoryRef Id attribute nor is there any validity checking. Below is an example of a .ParaffinMold file that will insert a Component element that creates a registry key.

<

p class=”MsoNormal”><?xml version=1.0 encoding=utf-8?>
<
Wix xmlns=http://schemas.microsoft.com/wix/2006/wi>
    <
Fragment>
        <
DirectoryRef Id=INSTALLDIR>
            <
Component Id=HappyID
                       Guid=PUT-GUID_HERE>
                <
RegistryKey Root=HKLM
                       Key=SOFTWAREMy CompanyMy Product>
                    <
RegistryValue Name=InstallRoot Value=[INSTALDIR]
                Type=string KeyPath=yes/>
                </
RegistryKey>
            </
Component>
        </
DirectoryRef>
    </
Fragment>
</
Wix>

So there’s the new and improved Paraffin! Please let me know how it works for you. As always, please let me know if you have more feature requests for Paraffin. I’d also love to know what you think of Paraffin. Thanks for using it! Grab version 3.1 from this link.

[Edit 6/29: Per Rob Mensching’s comment below, fixed the RegistryKey example.]

We deliver solutions that accelerate the value of Azure.

Ready to experience the full power of Microsoft Azure?

Start Today

Blog Home

Stay Connected

Upcoming Events

All Events