[wix-users] Pointing Heat at Referenced Project Output Folder

Luca Bacci luca.bacci982 at gmail.com
Wed Dec 15 13:18:19 PST 2021


Here's the documentation:
https://wixtoolset.org/documentation/manual/v3/msbuild/target_reference/harvestdirectory.html

Regarding the first snippet, I think you should be using a $ character, not
%. So it becomes:

<PropertyGroup>
                <DefineConstants>GatewayFolder=$ (var.ProductAgentGateway.
TargetDir)</DefineConstants>
</PropertyGroup>

Anyway you don't need that at all! Wix already gives you the TargetDir (and
also other properties) of all referenced projects. See
https://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html

So the first snippet can be removed.

The second snippet about the Project reference looks ok to me.

As for the third snippet, I think it's wrong. You should not put a
HeatDirectory inside a Target. So delete it altogether. What you have to do
is define a ItemGroup with HarvestDirectory items inside:

<Project
...
<ItemGroup Label="HarvestDirs">
    <HarvestDirectory  Include="$(GatewayFolder)">
      <DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
      <ComponentGroupName>ProductAgentGateway</ComponentGroupName>
      <SuppressCom>True</SuppressCom>
      <SuppressRegistry>True</SuppressRegistry>
      <!--
      <KeepEmptyDirectories>True</KeepEmptyDirectories>
      -->
      <SuppressRootDirectory>True</SuppressRootDirectory>
      <PreprocessorVariable>var.GatewayFolder</PreprocessorVariable>
    </HarvestDirectory>
  </ItemGroup>
...
</Project>

A wxs file will be automatically generated during the build process and
included for compilation.

Question: how is the GatewayFolder property defined? Note that you might
have to define it as a relative path due to an issue in Wix, see
https://github.com/wixtoolset/issues/issues/4493


Il mer 15 dic 2021, 20:27 Bryan Dam via wix-users <
wix-users at lists.wixtoolset.org> ha scritto:

> We're reorganizing our code in a way that put the Wix 3.11 installation
> projects in the same solution as the project we want it to install.  We
> already use Heat but it's pointed it at what I call 'magic folders' where
> the build pipeline had to put together the binaries into that magic folder
> by downloading them different pipelines.  I've been reading and trying
> different tactics for a couple of days but nothing seems to work.
>
> I've avoided using HeatProject since avoiding it seems to be the widely
> accepted suggestion, by Rob himself.  But maybe that's dated?
> In theory, I have a referenced project that gives me preprocessor
> variables that I should be able to pass to HeatDirectory but nothing I've
> tried has seemed to work.
>
> Below is a one of the many things I've tried and high-level what I think
> needs to happen but I'm clearly missing some concept or syntactical sugar
> to make it actually work. I've tried every variation on this theme that I
> can think of but each time either the project won't load, it complains that
> Heat wasn't passed a Directory value, or the directory points at the
> installation project's output folder instead of the reference project.
>
> Would love any feedback/guidance on how to point Heat at a referenced
> project and consume the entirety of its output.
>
>
>
> <PropertyGroup>
>
> <DefineConstants>GatewayFolder=%(var.ProductAgentGateway.TargetDir)</DefineConstants>
> </PropertyGroup>
>
> ...
>
> <ItemGroup>
>                 <ProjectReference
> Include="..\Product.AgentGateway\Product.AgentGateway.csproj">
>                   <Name>ProductAgentGateway</Name>
>                   <Project>{70d701d1-1909-4cca-936e-0dd641ad0dba}</Project>
>                   <Private>True</Private>
>                   <DoNotHarvest>True</DoNotHarvest>
>
> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
>                   <RefTargetDir>INSTALLFOLDER</RefTargetDir>
>                 </ProjectReference>
> </ItemGroup>
>
>  ...
>
> <Target Name="BeforeBuild">
> <HeatDirectory
>                 AutogenerateGuids="true"
>                 ComponentGroupName="ProductAgentGateway"
>                 Directory="$(GatewayFolder)"
>                 DirectoryRefId="INSTALLFOLDER"
>                 NoLogo="true"
>                 OutputFile="$(ProjectDir)\Files.wxs"
>                 PreprocessorVariable="var.GatewayFolder"
>                 SuppressCom="true"
>                 SuppressRegistry="true"
>                 SuppressRootDirectory="true"
>                 ToolPath="$(WixToolPath)"
>                 Transforms="Filter.xsl"
> />
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>



More information about the wix-users mailing list