wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
130 stars 24 forks source link

Heat is not harvesting native x64 COM DLLs properly #8803

Open Nico-Ko opened 3 weeks ago

Nico-Ko commented 3 weeks ago

WiX Version

5.0.2

.NET or MSBuild or Visual Studio Version

.NET 8.0.400 Visual Studio 17.11.2

HeatWave Version

1.0.4

Windows Version

Win 11 23H2

Repro Repo

https://github.com/Nico-Ko/Example-Repository

Repro Steps

  1. Build the Polygon Project to build a native X64 COM DLL
  2. Build the SetupProjectX64 to try to harvest the COM DLL with the HarvestFile Element and a Heat.exe call

Actual Result

Heat harvests the COM DLL and generates the wxs file and shows this warning: warning HEAT5150: Could not harvest data from a file that was expected to be a SelfReg DLL

The build then fails with these two errors: WIX0010 The TypeLib/@Language attribute was not found; it is required. WIX0047 The TypeLib element is non-advertised and therefore requires a parent File element.

Expected Result

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="HeatExeX64">
            <Component Id="cmp1gt63DaJVcY.cQns0p9EJHfGeGo" Directory="INSTALLFOLDER" Guid="{A14CE815-D5FF-4D52-A8DF-535A54AE06A5}">
                <File Id="fil4WCy4.aIkUUAfD79mnQaoCiRm18" KeyPath="yes" Source="$(DllPath)\Polygon.dll">
                    <TypeLib Id="{4069CF31-301C-4D97-A532-C99FA94041B3}" Description="PolygonLib" HelpDirectory="INSTALLFOLDER" Language="0" MajorVersion="1" MinorVersion="0">
                        <Class Id="{B7EF56BD-C04F-4DB6-B7E1-0FF4BEA3A711}" Context="InprocServer32" Description="PolyCtl class" ThreadingModel="apartment" Version="1.0" Insertable="yes" Programmable="yes" Control="yes" />
                        <Interface Id="{0B624377-52DB-4963-AD0B-2E648EBC3DA1}" Name="_IPolyCtlEvents" ProxyStubClassId32="{00020420-0000-0000-C000-000000000046}" />
                        <Interface Id="{CD1F2176-9058-4E2B-ABAF-ECC703CA832F}" Name="IPolyCtl" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
                    </TypeLib>
                </File>
                <RegistryValue Root="HKCR" Key="CLSID\{b7ef56bd-c04f-4db6-b7e1-0ff4bea3a711}\MiscStatus\1" Value="131473" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{b7ef56bd-c04f-4db6-b7e1-0ff4bea3a711}\MiscStatus" Value="0" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{b7ef56bd-c04f-4db6-b7e1-0ff4bea3a711}\ToolboxBitmap32" Value="[!fil4WCy4.aIkUUAfD79mnQaoCiRm18], 106" Type="string" Action="write" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

This file was created by a Heat version where the following line was patched:

https://github.com/wixtoolset/wix/blob/a75f23d32c3892e9977e7a48b4b347342ab182a9/src/tools/heat/UtilFinalizeHarvesterMutator.cs#L859C32-L859C132

From this:

else if (5 == parts.Length && String.Equals("win32", parts[4], StringComparison.OrdinalIgnoreCase))

to this:

else if (5 == parts.Length && (String.Equals("win32", parts[4], StringComparison.OrdinalIgnoreCase) || String.Equals("win64", parts[4], StringComparison.OrdinalIgnoreCase)))

This appears to fix the issue, however it is not clear to us if this is the right location. So we created this bug to make sure we did not overlook something.

Please let us know if this fix should be submitted as a Pull Request.

Acknowledgements

barnson commented 3 days ago

We'd take a pull request. Note that Heat is deprecated: https://github.com/wixtoolset/issues/issues/6838

Nico-Ko commented 3 days ago

@barnson Could you please assign me to this issue then?