Given the imminent demise of Visual Studio Setup and Deployment Projects, I’ve started to take a look at using Windows Installer XML (WIX) 3.5 as our installer of choice.
In this initial post, I’d just like to ensure others are not ‘bitten’ by an issue that took up way too much of my time relatively early on during my exploration.
Assuming you already have Visual Studio 2010 installed, download WIX 3.5 (released on January 31st 2011). You can then add a new WIX installer setup project:

Once you’ve create a project, you can right click, select properties and take a look at various project settings…nothing too exciting here…
From this point on, there’s no UI…but that’s fine…we’re developers, and quite happy to create/edit Xml.
So you’ll be needing to look at the WIX 3.5 Manual, and maybe the Tutorial. No doubt, you’ll then start googling for various posts and articles discussing WIX development…and that’s where it starts getting a bit ‘tricky’…
As WIX is now on version 3.5 (and 3.6 is also available, though not release yet), there is a lot out there on the subject. However, that results in a lot of ‘noise’ making it hard to find what you want, and also as a novice you are left ‘unclear’ whether the information you are reading is still appropriate or whether it has been superseded or made obsolete.
The other thing you may notice is that there’s currently a bias towards standard client/console applications, so if you are trying to create a nice new installer for your ASP .NET Web Application, you may find your installer creation progress somewhat slower, but probably more ‘interesting’.
Anyway, I digress…here’s how I got bitten:
Visual Studio File Encoding
I decided to try out a custom action script as explained here by some guy called Cheeso. Rather than creating another project/assembly, it makes use of Javascript to get a list of websites for the user to pick from. So in VS2010 I right clicked on the installer project and added a new WIX Text File but changed the suffix to js…and then copied and pasted the script provided.
However, after building my setup, when I ran it (I suggest you make sure when you run you get a verbose log created, MySetup.msi -lv Log.txt ) the package failed and the log detailed the following:
"There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action EnumerateWebSites script error -2146823279, Microsoft JScript runtime error: '' is undefined Line 1, Column 1,
Action ended 11:10:51: EnumerateWebSites. Return value 3."
This is where the danger of playing with a new technology kicks in! You end up missing the obvious because you look for faults elsewhere.
I played with changing the build actions and output directory settings of the file, adding paths to the SourceFile setting, questioned whether I needed to specify Win64=”yes”…
Thankfully Thom Leigh (a fellow WiX-users member) put me out of my misery and pointed out the obvious issue I’d totally bypassed:
'' is the UTF-8 Byte Order Mark (BOM), which indicates that the file is saved with BOM…hence the problem. (You will find lots of posts talking about VS and BOM…here’s one.)
So, open your js file, and pick Advanced Save Options from the File menu

You will most likely have the following set by default

I originally tried changing this to Unicode without signature:

But that simply resulted in a different character displayed with the same error: ÿþ
In the end, the setting that worked for me was:

Note: when you click Ok, and then actually save the file you may get a Source Control warning dialog appear…I just clicked OK on it, and everything was/is fine.
Conclusion
Although things feel slow initially with WIX, you quickly see the power and flexibility that it offers as a solution…and this helps motivate continued learning and use.
Print | posted on Saturday, 5 February 2011 4:18 PM