Registering DLLs in COM with WiX for creating an MSI installation package for a Kofax Custom Panel
I was working on a project recently for a customer that was upgrading their Kofax versions and making some enhancements to a custom Kofax panel that we had written for them some time ago. Like any good developer, I migrated the code for the custom panel to the latest version of Visual Studio I had, (in this case, Visual Studio 2012). I had finished development and was discussing installation when the customer requested an MSI package to install the custom panel. Unbeknownst to me, Visual Studio 2012 had dropped their support for the easy, drag and drop, built in set up and deployment project to create MSI’s.
In doing some research, I found many developers had migrated to using the open source WiX product to create MSI packages, (http://wix.codeplex.com/). One can download WiX and integrate it directly into Visual Studio. Everything was fairly straight forward on following their tutorials except for one snag: in order to get the custom Kofax panel to install correctly, I had to register the custom DLLs as COM Components, not in the GAC. After a lot of head scratching, I finally figured out that I could use Heat (one of the WiX tools) to create a registry file of the DLLs to include in my WiX set up project. You can find out more about Heat here: http://wixtoolset.org/documentation/manual/v3/overview/heat.html. After the file was generated I was able to take the output of the Heat generated file and include it in my WiX install project to register the necessary DLLs. To do this, I followed these steps:
1. Using the Visual Studio Developer prompt
2. Enter this command into the prompt: “path to heat” file “path to dll” -ag -template:fragment -out “path to output file.wxs”
3. Open the file created in the output location specified
4. Copy and paste code fragment into WiX set up project
*Note: The install folder and component Id values must be edited. The component Id needs to be changed to register the DLLs with RegAsm. Ex: <Component Id=”RegAsm” Guid=”*”>