installationdeploymentwixwindows-installerheat

Heat harvesting in Wix 5 - wix doesn't find the namespace components


I am trying to create an MSI file using Wix version 5.0.2. In my VS project, I added the NuGet package FireGiant.HeatWave.BuildTools.wixext and also the HeatWave extension for VS2022. My goal is to create an MSI that installs a WPF application in Program Files. For that, it must install the published WPF. It also needs to create an appearance folder to store some icons, and a runtime folder to store the Python executable file and the other necessary subfolders and files for Python. I am stuck on trying to capture the WPF project output. This is my code so far:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:hbt="http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools">
    <Package Manufacturer="Denis Ivanov" 
             Name="Adjustrix Desktop" 
             UpgradeCode="5e40079f-d71d-4357-8339-bea315159720"
             Version="0.1">
        <StandardDirectory Id="ProgramFilesFolder">
            <Directory Id="PFRoot" Name="Adjustrix">
                <Directory Id="DesktopRoot" Name="Desktop">
                    <Directory Id="AppearanceFolder" Name="appearance"/>
                    <Directory Id="RuntimeFolder" Name="runtime"/>
                </Directory>
            </Directory>
        </StandardDirectory>

    <Feature Id="AppearanceInstall">
        <Component Directory="AppearanceFolder">
            <File Source="C:\Users\denis\source\repos\Adjustrix\Logo3.ico"/>
        </Component>
    </Feature>

    <Feature Id="ProgramInstall">
        <Component Directory="DesktopRoot">
            <File Source="C:\Users\denis\source\repos\Adjustrix\AdjustrixWPF\bin\Release\net8.0-windows\AdjustrixWPF.exe"/>
        </Component>
        <Component Directory="RuntimeFolder">
            <hbt:HarvestProjectOutput Id="AdjustrixWPF">
                
            </hbt:HarvestProjectOutput>
        </Component>
    </Feature>
</Package>

This is from my wix project file to show that I am referencing the WPF project:

<Project Sdk="WixToolset.Sdk/5.0.2">
<ItemGroup>
  <PackageReference Include="FireGiant.HeatWave.BuildTools.wixext" Version="5.0.3" />
  <PackageReference Include="WixToolset.Heat" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AdjustrixWPF\AdjustrixWPF.csproj" 
                  Publish="true" 
                  HarvestOutputGroup="PublishedItemsOutputGroup" />
</ItemGroup>
</Project>

When I try to build the code from the command line, I get these errors:

error WIX0200: The Component element contains an unhandled extension element 'HarvestProjectOutput'. Please ensure that the extension for elements in the 'http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools' namespace has been provided. C:\Users\denis\source\repos\Adjustrix\AdjustrixWpfInstaller\Package.wxs(27) : error WIX0230: The Component/@Guid attribute's value '*' is not valid for this component because it does not meet the criteria for having an automatically generated guid. Components using a Directory as a KeyPath or containing ODBCDataSource child elements cannot use an automatically generated guid. Make sure your component doesn't have a Directory as the KeyPath and move any ODBCDataSource child elements to components with explicit component guids. C:\Users\denis\source\repos\Adjustrix\AdjustrixWpfInstaller\Package.wxs(27) : error WIX0330: The Component/@Id attribute was not found; it is required when there is no valid keypath to use as the default id value. I tried to fix it, but got stuck. Any help will be appreciated!


Solution

  • It looks as though you have the PackageReference set correctly. My guess is that you did not do a "restore" after adding the PackageReference lines to your .wixproj. Any of the following options will work:

    1. msbuild -Restore from the command-line will restore all your package references and do the default action (usually, "Build"). I pretty much always use this command-line so I don't have to think about whether I did a restore.
    2. dotnet build from the command-line ends up (for the most part) the same as the first option. I've started adopting this in command-line examples because it is easier (and, thus, always works).
    3. Use Visual Studio (with HeatWave). Visual Studio does a bunch of stuff as part of the build process. Restoring is one of them.

    I used dotnet build with your example files and things worked.