Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replicating Visual Studio COM registration with a WiX Installer

People also ask

What is WiX Visual Studio?

The Visual Studio WiX toolset allows you to easily create WiX projects, edit WiX files using IntelliSense, and compile/link your project within the Visual Studio IDE. For WiX project types, see WiX Project Types. For WiX item templates, see WiX Item templates.

How does WiX Installer work?

The WiX tools follow the traditional compile and link model used to create executables from source code. At build time, the WiX source files are validated against the core WiX schema, then processed by a preprocessor, compiler, and linker to create the final result.


You should use Heat (WIX 3.0) located in the bin directory of the version you are using. Have a look at this blog post, we use it here to register all our COM objects, by creating a wix fragment...

something like

heat file MyComExposedLibrary.dll -out MyComExposedLibrary.wxs

After, reading your edit, I would create a basic msi with wix that installs the com object only, see if that works ... then you'll know which battlefield to attack ...


I recently ran into this issue, and the simplest workaround I could find follows these steps on the development machine:

  1. Run: Regasm MyDLL.dll /tlb:MyDLL.tlb
  2. Run: Heat file MyDLL.dll -out MyDll-1.wxs
  3. Run: Heat file MyDll.tlb -out MyDll-2.wxs

MyDll-2.wxs contains a <Typelib> element that you will want to copy and nest inside the <File> element that was generated in MyDll-1.wxs. This will give you a complete <Component> element that you can use in the installer project.


To extract the COM information, tallow will use the regasm.exe tool included with the .NET framework. It is likely that visual studio uses the same tool to register assemblies when you enable "register for COM interop".

The difference is that tallow will use the regasm /regfile switch to send the information to a .reg file instead of actually registering the assembly. Unfortunately the .reg file generated by regasm.exe is not complete. It skips the typelib entries which it does write to the registry during a real registration. This may be a bug in regasm.

To get your installer working you have three options:

  1. Add the missing registry keys to the tallow output manually. The tallow output is intended to be edited manually and saved along with your other wxs files anyway. You seem to be trying to fully automatically generate a working wxs file but I believe that was never a design goal of tallow.

  2. Use a custom action to invoke regasm from your installer. This is slightly evil because you may lose some of the strong transactional guarantees provided by the windows installer engine. I'm thinking of rollbacks triggered by a failure halfway during the install here.

  3. Avoid the registration altogether by making use of registration-free COM. This will require the creation of manifest files for both the application and the COM library.


I know this is an older question, but others may find this useful...

After struggling with this myself, I found that you can capture the type library information by using tlbexp.exe then heat both the dll and the tlb file. Include the outputs of both of those in your wix project and you should be good to go.

tlbexp.exe dllFile.dll /out:dllFile.tlb
heat.exe dllFile.dll ...
heat.exe dllFile.tlb ...