WiX Installation for Excel Add-In

Using WiX for installation development provides a simple way to quickly build installers, while maintaining the power to extend to the most difficult deployment scenarios. For the deployment requirements of an Excel Add-In you should read Deploying Application-Level Add-ins, on the MSDN site.

Firstly, it is required to register your COM Add-in. This can be done from the command line using the RegSvr32 executable. In WiX, all that is required is:

<File Id="Addin_Dll" Name="Addin.dll" Source="Addin.dll" KeyPath="yes" >
    <Class Id="{CLSID UUID}" Context="InprocServer32" Description="Addin" ThreadingModel="apartment" >
        <ProgId Id="Addin.Connect" Description="Connect Class" />

The Addin.dll is  a C++ COM component. Similarly can be done registering a .NET Assembly with COM Interop. The required registry keys are very simple with WiX to add:

<Registry Root="HKLM" Key="Software\Microsoft\Office\Excel\Addins\Addin.Connect" 
          Name="Description" Value="Description for Addin.Connect" Type="string" />
<Registry Root="HKLM" Key="Software\Microsoft\Office\Excel\Addins\Addin.Connect" 
          Name="FriendlyName" Value="Addin.Connect Friendly Name" Type="string" />
<Registry Root="HKLM" Key="Software\Microsoft\Office\Excel\Addins\Addin.Connect" 
          Name="LoadBehavior" Value="3" Type="integer" />

To register the add-in for just the current user on the computer, simply change the Root value to HKCU. It is also prudent to add a pre-installation condition that Excel in installed on the target machine:

<Property Id="P_EXCEL11INSTALLED">
    <RegistrySearch Id="SearchExcel11" Type="raw"
        Root="HKLM" Key="SOFTWARE\Microsoft\Office\11.0\Excel\InstallRoot" Name="Path" />
<Condition Message="You must have Microsoft Office Excel 2003 installed to use this product.">

Adding these few blocks to your standard installation is all that is required in WiX to deploy an Office Excel Add-In.

3 thoughts on “WiX Installation for Excel Add-In

  1. So what do you know about deploying VSTO 3 add-ins for Office 2007?
    I\’ve been researching it and I have it working but I\’m not convinced it\’s the best way to do it.   Basically I have to write CA\’s to shell out to VSTOInstaller.exe /Silent /Install and have it process the .vsto package.   

  2. I have not yet done much development against Office 2007. I have a Visual Studio setup project that I have been using to experiment deploying add-ins for Office 2007. I looked at what the Visual Studio Office Add-In project configured. It appears as a COM Add-In within Excel on the add-in list. In the registry, the keys are similar to a COM Add-In, with one exception, the HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\<application name>\\Addins\\<add-in ID>\\Manifest listed is C:\\Path\\ExcelAddIn1.vsto|vstolocal.
    After installing this though, when first launching the office application, the “Microsoft Office Customization Installer” dialog was shown, prompting to “Install” or “Don’t Install”.

    I could not get this to happen yet on a clean Virtual Machine, I think I have some pre-requisites on my development machine that I am still missing. Let me know when you crack it. I hope that this helps!

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 )

Facebook photo

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

Connecting to %s