0

I am working on a project for an installer with wix4. Even if wix4 is still a release candidate, my team wants it to work. To harvestthe project, which will be installed, I use HarvestProject. Although the structure of the target project contains extensive and many binaries (over 200 dll Files), these are not harvested. What am I doing wrong?

Due to company secrets and the length of the file, I can unfortunately only show a small part.

.wixproj

<Project Sdk="WixToolset.Sdk/4.0.0-rc.2">
    <PropertyGroup>
        <PreBuildEvent />
        <BuildVersion>0</BuildVersion>
        <DefineConstants>Version=$(BuildVersion)</DefineConstants>

        <EnableProjectHarvesting>true</EnableProjectHarvesting>
        <HarvestProjectsSuppressUniqueIds>true</HarvestProjectsSuppressUniqueIds>
        <HarvestProjectsDirectoryIds>HARVESTROOT</HarvestProjectsDirectoryIds>
        <HarvestProjectsVerboseOutput>true</HarvestProjectsVerboseOutput>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="WixToolset.UI.wixext" Version="4.0.0-rc.3" />
        <PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-rc.3" />
        <PackageReference Include="WixToolset.Heat" Version="4.0.0-rc.3" />
    </ItemGroup>
    <Target Name="BeforeBuild">
        <HarvestProject Include="..\Project.Cockpit\Project.Cockpit.csproj" ProjectOutputGroups="Binaries;Content;Satellites;Documents;Symbols">
        </HarvestProject>
    </Target>
    <ItemGroup>
        <ProjectReference Include="..\Project.Cockpit\Project.Cockpit.csproj" />
    </ItemGroup>
</Project>

package.wxs

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    
    <?if $(var.Platform) = x64?>
        <?define ProductCode="{7CB9D807-FBE2-43F6-BE10-4D11F3710CC4}"?>
    <?else?>
        <?define ProductCode="{B3311294-346C-488B-BEA3-99E8C007F6F4}"?>
    <?endif?>
    
    <?define UpgradeCode="{CEC07130-016B-4F2F-8700-C1C21AD095FF}"?>
    
    <?define BuildVersion="0.0.1"?>
    
    <?define Name=""?>
    <?define Manufacturer=""?>
    
    <Package Name="$(var.Name)" 
             Manufacturer="$(var.Manufacturer)" 
             Version="$(var.BuildVersion)" 
             UpgradeCode="$(var.ProductCode)"
             Scope="perMachine"
             >
        <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" AllowSameVersionUpgrades="false"/>
        <MediaTemplate EmbedCab="true"/>


        <UI>
            
            <!-- Public Fonts -->
            <TextStyle Id="Font" Bold="false" FaceName="Tahoma" Size="12"/>
            <UIRef Id="Installer_UI"/>
        </UI>

        <Feature Id="Main">
            <ComponentGroupRef Id="MainComponents" />
        </Feature>

        <StandardDirectory Id="TARGETDIR">
            <Directory Id="INSTALLFOLDER" Name="App">
                <Directory Id="HARVESTROOT" ComponentGuidGenerationSeed="3EA2F4ED-C5FD-409C-9FCF-144AB5ECF085" />
            </Directory>
        </StandardDirectory>

        <ComponentGroup Id="MainComponents" Directory="INSTALLFOLDER">
            <ComponentGroupRef Id="Project.Cockpit.Binaries" />
        </ComponentGroup>
        
        
    </Package>
</Wix>

_generated.wxs

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    <Fragment>
        <DirectoryRef Id="Project.Binaries">
            <Component Id="Project.Binaries.Cockpit.runtimeconfig.json" Guid="*">
                <File Id="Project.Binaries.Cockpit.runtimeconfig.json" Source="$(var.Project.Cockpit.TargetDir)\Cockpit.runtimeconfig.json" />
            </Component>
            <Component Id="Project.Cockpit.Binaries.Cockpit.dll" Guid="*">
                <File Id="Project.Cockpit.Binaries.Cockpit.dll" Source="$(var.Project.TargetDir)\Project.Cockpit.dll" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Project.Cockpit.Binaries">
            <ComponentRef Id="Project.Cockpit.Binaries.Cockpit.runtimeconfig.json" />
            <ComponentRef Id="Project.Cockpit.Binaries.Cockpit.dll" />
        </ComponentGroup>
    </Fragment>
</Wix>

I tested different ways to Harvest the project. Changing ProjectOutputGroups does not change anything. Harvesting as can be seen on https://wixtoolset.org/docs/reference/heat/ gives me an error for multiple use of componentId.

Is there a way to fix this? Im new to WiX 4 so I may be missing something.

Flori
  • 1
  • 1
  • Can you set your MSBuild verbosity to detailed or diagnostic and post the error that heat produces here? You can set it in your VS Options under Projects and Solutions -> Build and Run. The log should give a hint on what went wrong while harvesting. – Lucas Apr 27 '23 at 09:06

1 Answers1

0

Maybe you need the <DoNotHarvest>False</DoNotHarvest> line

<ProjectReference Include="..\Project.Cockpit\Project.Cockpit.csproj">
    <DoNotHarvest>False</DoNotHarvest>
</ProjectReference>
Tim
  • 1