Tuesday, July 7, 2009

Wix v3 Component Reference

If you're like me and you're doing websites with lots of images that you need to package up in an install, you realize that this becomes a daunting task in Wix, even if you use heat to generate the wxs file for you. The problem with heat is that it does not create the component refs that you need for the features and when you have to do this by hand, it is a complete pain! I ran into this on a project of mine recently and after the first 78 copy/paste operations, I decided that this should be automated...so the Wix Component Ref Generator was born.



The Wix Component Ref Generator is a basic .NET 2.0 WinForms program that takes the xml that was generated by heat and allows you to create a list of Component Refs that you can add to your features. I will post the source for anyone who wants to user/modify it.

http://wixgen.codeplex.com

Friday, June 19, 2009

Beginning Installations and Headaches

Installations have never been part of my job title but for those developers out there, few projects that we work on are ever in our "title". Around here, I've been deemed "install guy" by our group and so I've been tossed into the wonderful [/sarcasm] world of installations. My boss has been using a real old version of Wise but he appeared to like it. Naturally, I was asked to evaluate some other software technologies to see which would suit our development.

Now comes the interesting part...

After downloading some different software packages and testing them out, I decided on InstallShield version 11.5 (mind you this was back in 2005) and when I was using InstallShield, I thought it was the greatest thing ever. It supported .NET 2.0 and had some other cool features that I thought would be very handy. After making my recommendation, the company purchased our brand spankin new copy of InstallShield 11.5 for Windows. I was so excited about having a new "toy" that I started working away on an install for our product and so my headaches began...

If anyone has come from a development background and is asked to put together an installation for Windows Installer, you'll know where I'm coming from. Windows Installer is...to put it nicely...not very easy to learn. Merge Modules, Features, Components...they all started running together so on went my OO hat. Features...that should be like our product features...got it. Merge Modules...that should be like Objects...got it. Components...that should be like...Objects?? Ok this wasn't making sense so off to wild wild web to find some tutorials or explanations.

I stumbled across some nice tutorials on MSDN to help me sort out the differences so I was back to work! Now that I understood Windows Installer terminology, I felt like I was ready to tackle our new software. Boy was I wrong!

Doing XML configuration changes in InstallShield 11.5 is horrific (actually they are horrific all the way to version 2009). Adding files, causes new components to be created (no stop that!). Dialog navigation...yea...you must write a book of conditions to determine where your dialogs go next. I remember sitting back in my chair going "when is the IDE going to help me instead of causing me more work?"

After many weeks of splitting headaches, I gave up and said the typical developer thing "let's just use XCopy for now."

Fast forward to 3 weeks ago...

I've been put back on to Installations (ugh!) so I started reading some favorite blogs of mine (Christopher Painter: http://blog.deploymentengineering.com/, InstallSite: http://msmvps.com/blogs/installsite/default.aspx, etc) and I started seeing talks about this product "Wix". Hmmm...this is a new toy...let's try it out! Downloaded it, went thru the Wix tutorial (http://www.tramontana.co.hu/wix/) and off I went! Created a simple setup for one of our products (no sweat!) and so I went back to tell the boss "hey boss...got a new install tool!" Of course, I show him what I had done and he was sold (he couldn't stand InstallShield either).

Fast forward to the present...

I've been working on our main product installation and guess what...you guessed it...more headaches! First off, the documentation available for doing things in Wix is...well...sparse. There are no books on it (of course that doesn't surprise me...there weren't any for InstallShield). Secondly, it's a little difficult to debug. Now I know I sounded before like I completely dispised InstallShield (which really isn't completely true) but I am realizing that I miss some things about InstallShield (MSIDebugger to be specific). I only say this becausing combing through MSI installation logs is not exactly fast nor is it easy on the eyes.

My new issue is with Wix's XmlFile standard action. I've got it functioning just fine on installation...works beautiful and didn't require a lot of work to figure out how to use it. But here's the catch...on uninstall, the second configuration file causes the uninstall to rollback! Doh! What is it now?!?

I headed back to the wild wild web and found a great posting by gisenberg (http://blogs.msdn.com/gisenberg/archive/2007/10/09/wix-v3-and-xmlconfig-xmlfile-troubleshooting.aspx) that stated that XmlFile has issues with uninstall and to switch to the XmlConfig action instead. This required a little bit of rewriting but luckily I was able to copy several items from the XmlFile action. Note: You must use Action and Node properties appropriately if you want this to set/update an attribute of an existing element (Action="create" and Node="value"). I hope this will be the last bit of trouble I have with this installer but I seriously doubt it.