WiX shortcuts...
(Long) Shortcuts
Shortcuts are a basic concept in installers... and doing them with WiX is easy... once you know how... I just spent the last 10 minutes trying to get an Icon assigned to an advertised shortcut, here's how you do it...
Name="SomeCompany.SomeProduct.HostApp.exe"
DiskId="1"
Source="....buildSomeCompany.SomeProduct.HostApp.exe"
Vital="yes">
Id="SomeCompanySomeProductHostAppShortcut"
Directory="ProgramMenuDir"
Name="My Product"
WorkingDirectory="INSTALLDIR"
Description="SomeProduct Application"
Icon="HostAppShortcutIcon.exe">
SourceFile="....buildSomeCompany.SomeProduct.HostApp.exe" />
The oddity is the way the Icon must be named with an ".exe" extension for it to work.... For non-advertised shortcuts you can get away with just leaving the icon out altogether.
Now something else my client wanted that I had to wrestle with a bit... how to create an uninstall shortcut for your product in the program menu's directory... here's how I achieved it, by creating a shortcut to msiexec.exe - I'm damn sure there must be easier way though, this is very clunky, but at least it works for now - if anyone knows an easier way then drop me a comment...
Personally I think uninstall links in the program menu are a waste of time... but in this case I wasn't the target audience I guess :P
Note: The "$(var.PRODUCTGUID)" refers to a constant being passed to WiX from my continuous integration build (I have a custom msbuild task for generating a single unique productId guid per revision in SVN)...
First off I define a couple of custom actions...
I then evaluate them as part of the "InstallExecuteSequence" ... this doesn't actually have to be run before "FindRelatedProducts"... you can evaluate them quite late in the installation process.
And then we can create our shortcut...
You might be wondering why I place a dummy registry entry in there... well it's because otherwise you end up with an ICE 38 error - which seems daft to me, but then I don't really know enough about the windows installer architecture to dispute ICE's errors ;o) (ICE stands for Internal Consistency Evaluator(s) - which is used to validate the installer produced by WiX - have a look here for more info).
At any rate... I like the way WiX works... I would never go back to a gui-based setup project tool again, they might be fine for small projects, but once your project grows it just starts to suck hard... why? well... 4 reasons off the top of my head:
- You can't diff between versions easily... just what did you coworker change in the setup last checkin?
- Lack of global search and replace...
- Generally a little more difficult to fit into CI builds.
- Some of the products require you to use regasm or CLR code to register assemblies for com interop.
-
The wix user group on sourceforge.
-
The wix wiki - though it's a little light on content in places.
-
Windows installer reference on MSDN.
BTW - I haven't forgotten about my LINQ series... It's just on the back burner at the moment.