Search code examples
vb6wixwindows-installermerge-module

tabctl32.msm installed by WiX does not register the ocx


I'm moving an old VB6 app from InstallShield to WiX installer driven by a Visual Studio WiX project. It's all good except that I need the Microsoft tab control from tabctl32.msm. When I include this in my WiX project, the OCX installs but does not work until I run regsvr32 on it.

Using either InstallShield or the Visual Studio Installer, the msm correctly registers its component. I assume that it's the msm's job to do that.

I am installing per-machine and the msi runs as administrator. Here's some simplified WiX code that illustrates the problem:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="TabCtlTest" Language="1033" Version="1.0.0.0" Manufacturer="A Company" UpgradeCode="bd70911b-976f-462d-b381-26bc4dc0758e">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />

        <Feature Id="ProductFeature" Title="TabCtlTest" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
            <MergeRef Id="TABCTL32"/>
            <MergeRef Id="COMCAT"/>
            <MergeRef Id="OLEAUT32"/>
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Merge Id="TABCTL32" SourceFile="$(env.ProgramFiles)\Common Files\Merge Modules\TABCTL32.MSM" Language="1033" DiskId="1" />
            <Merge Id="COMCAT" SourceFile="$(env.ProgramFiles)\Common Files\Merge Modules\COMCAT.MSM" Language="1033" DiskId="1" />
            <Merge Id="OLEAUT32" SourceFile="$(env.ProgramFiles)\Common Files\Merge Modules\OLEAUT32.MSM" Language="1033" DiskId="1" />
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="TabCtlTest" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="cmp59A149A53D5CFB2D09E03E213D57D2E4" Guid="{BA66D5C5-0813-4822-9F40-8E5C9B242E8B}">
                <File Id="fil36DDAE6925146DA614B90C0E87BD68AC" KeyPath="yes" Source="..\vbprog\Project1.exe" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

I'm using Visual Studio 2015 and WiX 3.9.


Solution

  • After poring over the different msi's with Orca I found some missing items. When I added

    <InstallExecuteSequence>
        <RegisterClassInfo Sequence="4200" />
        <RegisterProgIdInfo Sequence="4300" />
        <WriteRegistryValues Sequence="4400" />
    </InstallExecuteSequence>
    

    to the Product node it caused COM registration to occur. It seems that InstallShield and Visual Studio Installer do this automatically but, like with so many things, to do it with WiX you have to dig into it and figure it out for yourself. And no, I have no theory for what those sequence numbers should be. I pulled them out of my hat after comparing the Orca displays.