Registering DLLs using .reg file in WiX

801 views Asked by At

Background to Question

I am currently in the process of trying to put together a means of distributing a new project I am working on which requires that a COM exposed .NET DLL be registered on the user's system and as I am new to WiX and making the move to it for this I am trying to keep things as simple as possible.

The Problem

The big issue with my DLL registration is that regasm sets the default value of the InProcServer32 key to "mscoree.dll", but my DLL can only seem to be instantiated when the full path to it is used, e.g. "C:\Windows\SysWow64\mscoree.dll"

Currently I have a custom action in my setup project (which I want to abandon to use WiX) which will call the SearchPath API to find the full path to mscoree.dll and overwrite the default value with the full path, so that the DLL can be instantiated without any issues.

Proposed Solution / Question

As I am new to WiX I have had the idea of preparing a .reg file that will contain all the necessary information to go into the CLSID tree and then having WiX execute that some how.

My question is:

  1. Are there any inherent flaws by registering a DLL this way?
  2. As the main reason I am trying to find work arounds here is the mscoree.dll issue, is there any native means of doing this in WiX?
1

There are 1 answers

3
Christopher Painter On BEST ANSWER

Take a look at the WiX program called "Heat". This can "harvest" your DLL including registry information related to the RegAsm / COMVisible parts. You can then snip this code and work it into your wxs file.

You can also use Regasm /regfile and then manually transform that information into RegistryValue elements.

With regard to your path problem, use the SystemFolder property.

[SystemFolder]mscoree.dll

If you mark your install as 32bit (x86) this will automatically resolve to the SysWow64 folder when run on a 64bit OS and the System32 folder when run on a 32bit OS.