How to deploy an Excel XLL Add-In and automatically register the Add-In in Excel

11,682

Solution 1

Using IsWix and Wix 3.7, I was able to resolve this.

Useful links for how to register the components are as follows:

For generating a C# class to handle Windows Installer Custom Actions: http://www.codeproject.com/Articles/132918/Creating-Custom-Action-for-WIX-Written-in-Managed?fid=1599130&df=90&mpp=25&noise=3&prof=False&sort=Position&view=Quick&spc=Relaxed&select=4131367&fr=1#xx0xx

http://blogs.msdn.com/b/jschaffe/archive/2012/10/23/creating-wix-custom-actions-in-c-and-passing-parameters.aspx

For setting the property of the CustomAction.config file to Content WIX Custom Actions built for .Net Framework 4.0 does not work? Ways to resolve?

EDIT 1:

For general knowledge on WiX (Very important) http://channel9.msdn.com/blogs/scobleizer/wix-team-the-most-used-piece-of-software-at-microsoft-and-its-open-source#Page=2

Solution 2

To detect Excel 32-bit vs. 64-bit, you can check the registry: Detect whether Office is 32bit or 64bit via the registry

For the OPEN, OPEN1, OPEN2 etc. you typically need a Custom Action in the install script that enumerates the keys.

Share:
11,682

Related videos on Youtube

Lee Z
Author by

Lee Z

Updated on September 21, 2022

Comments

  • Lee Z
    Lee Z about 1 year

    I have developed an Excel XLL using ExcelDNA and C#. I am at the point where I would like to begin testing the deployment, but cannot find much information that actually provides steps that work.

    My project was developed as a Class library with ExcelDna references. In the .dna file, I have the code below that will pack all resources into a packed version of the XLL (i.e. the Pack="true" attribute).

    <DnaLibrary Name="ExcelXLL" RuntimeVersion="v4.0" Language="C#">
      <ExternalLibrary Path="ExcelXLL.dll" LoadFromBytes="false" Pack="true" />
    

    I would like to deploy the packed XLL to the target machine in the path:

    %APPDATA%\Microsoft\AddIns
    

    In order to automatically register the XLL with Excel, I need to add a registry key that depends on the version of Excel that the user has.

    For instance, on my computer (Windows 7 64 bit running Excel 2007 32-bit), I would need to add a registry key to the following path:

    HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Options\
    

    The key would be type REG_SZ with the name OPEN (or OPEN1, OPEN2, etc.) and the value /R "ExcelXLL-packed.xll"

    I have 2 problems though. The first is in determining which version of Excel that the user has to get the correct path and the 2nd is to determine the correct OPEN version that I need to create (for example, if the user already has OPEN, OPEN1, and OPEN2 then I would create an OPEN3 key).

    I am trying to do the installation using either the Setup and Deployment project or a InstallShield LE project and cannot determine how to go about this. Does anyone know how to do this or a better way of doing it?

    EDIT 1:

    I have done a great deal of research on this and have looked at several windows installers.

    In the Package and Deployment and InstallShield LE, I can get the install/uninstall to work by putting an installer class into my class library and bundling project output with the install. In this approach, I handle inserting/removing the registry key using the installer class. The problem that I have is that the user must uninstall first before running a new install (no update capability).

    I downloaded the Setup Factory demo version and can get install/update to work but cannot do the framework check (not shipped with the demo). Also, the uninstall fails (though I may be able to get this to work with some more investigation).

    I am interested in using the WiX installer, but would like to know if anyone has a sample of how to perform the deployment using WiX. I would also like to know if I need to use the installer class or if there is a different way to handle the search for the OPEN[n] key under HKCU\Software\Microsoft\Office[Version].0\Excel\Options. If I were to use the project output to enable the installer class, then I need to have 2 separate target directories (one under Program Files for the basic project output and one under %appdata%\Microsoft\AddIns for the packed XLL).

    Any help is greatly appreciated.

    Thanks,

    Lee

  • Lee Z
    Lee Z about 10 years
    Hi Govert, please see my Edit 1 above as I have figured out what is needed but have been attempting to find an installer that will do the install, update, and uninstall options. Essentially, I need an installer that will allow me to overwrite one installation with a more recent install without forcing the user to uninstall first.