WiX v5 is here! Let us help.

Self-registration Advanced Harvesting

Allowing the Windows Installer to manage registry keys is much preferable to executing registration code, such as regsvr32.exe or regasm.exe, during installation. To that end, Advanced Harvesting can extract the registration out of harvested files. This includes:

  • Native .DLL and .OCX files that export DllRegisterServer
  • Native .EXE that support the -RegServer switch
  • Managed assemblies that use regasm.exe
  • TypeLibs
  • 32-bit or 64-bit

To enable self-registration harvesting add the SelfReg="true" attribute to the harvest directive. For example,

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:fg="http://www.firegiant.com/schemas/v3/wxs/fgwep.xsd">
  <Fragment>
    <ComponentGroup Id="ConsoleAppComponents">
      <Component Directory="INSTALLFOLDER">
        <fg:HarvestProject Name="ConsoleApplication1"
            OutputGroup="BuiltProjectOutputGroup"
            SelfReg="yes" />
      </Component>

      <Component Directory="INSTALLFOLDER">
        <fg:HarvestFile Source="!(bindpath.Foo)\path\to\foo.dll"
            SelfReg="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

The harvested registry keys are included in the Component with the self-registered file.