S h o r t S t o r i e s

// Tales from software development

WiX ALLUSERS=1

leave a comment »

I created an installer from scratch last week using WiX for the project I’m currently working on. Earlier this week I went to my client’s offices and ran the installer on one of their servers.

After the install completed successfully I quickly checked that the deployed software was functioning correctly. Everything looked OK until I manually ran a scheduled task that the installer created and it failed. It appeared that a COM component that the program called was not registered but when I ran the program in a command window it ran without any problems.

It took me a few minutes to realise what the problem was and how I’d caused it.

One of the installation actions is to install and register a COM library used by the program that the scheduled task calls. When I ran the program in a command Window it executed successfully but the scheduled task runs under a service account and this failed with a ‘Class not found’ error message.

The problem was that because I hadn’t specified the ALLUSERS property in the WiX file for the installer, the default value of “” (empty string) was used which creates a ‘per user’ install. One of the differences between a per-machine and a per-user installation is that COM Registration information is written under the HKCU (current user) registry key instead of the HKLM (local machine) key.

So, the COM component was only registered in the context of the account I was logged in with when the installer ran and it wasn’t registered in the context of the service account that the scheduled task runs under.

All that’s required to fix this is to set the ALLUSERS property to 1 by including a Property element for it under the Product element, e.g.

<!– Set ALLUSERS=1 to create a per machine install rather than a per user install. –>
  <Property Id=”ALLUSERS”><![CDATA[1]]></Property>

There’s a useful explanation of the differences between a per-machine and a per-user install on the MSDN website.

Advertisements

Written by Sea Monkey

September 29, 2009 at 6:00 pm

Posted in Deployment

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: