1

I am currently trying to create a wix installer, and found this article stating that WiX 3.8 cannot grab the references added in each projects files using heap. Is this still true for 3.10?

I do know how to add reference dlls manually but was really hoping I can use some automation.

I did find this stack overflow question answering similar question but the HeatProject approach seems to be not working for me.

<Target Name="BeforeBuild">
  <HeatProject ToolPath="$(WixToolPath)" AutogenerateGuids="true" OutputFile="OutputFile.wxs" SuppressFragments="true" Project="ReferencedProject.csproj" ProjectOutputGroups="Binaries" />
</Target>

This code snippet successfully generated OutputFile.wxs. However, when I removed the Component with exe File from manual wxs, the end-result msi did not install the .exe (along with all the references)

EDIT :

Content of OutputFiles.wxs is following

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="ReferenceProject.Binaries">
            <Component Id="cmp7C475BDFC8ADED831D737FA819051E2F" Guid="*">
                <File Id="filC6ECF306B200636DD5F3BA1DCBDA0F15" Source="$(var.ReferenceProject.TargetDir)\ReferenceProject.exe" />
            </Component>
            <Component Id="cmp4449C9C84D65952451BBDF1488B8BE48" Guid="*">
                <File Id="fil72052E64CE55C9B2516044DF15A1F318" Source="$(var.ReferenceProject.TargetDir)\ReferenceProject.exe.config" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ReferenceProject.Binaries">
            <ComponentRef Id="cmp7C475BDFC8ADED831D737FA819051E2F" />
            <ComponentRef Id="cmp4449C9C84D65952451BBDF1488B8BE48" />
        </ComponentGroup>
    </Fragment>
</Wix>

On my main wxs, I do have a Feature that is installed with a line

  <ComponentGroupRef Id="ReferenceProject.Binaries"/>

And yet the exe is not included (also referenced libraries)

Community
  • 1
  • 1
Shintaro Takechi
  • 1,215
  • 1
  • 17
  • 39
  • Can you post the contents of the OutputFile.wxs? My guess is you need to just add the Component/ComponentGroup reference to one of the features in your product for it to link in the contents of the OutputFile.wxs. I haven't used the HeatProject build task in my installers. – Brian Sutherland Jun 08 '16 at 19:18
  • @BrianSutherland Thank you very much for your input. I have edited my original post. and I made sure to have ComponentGroupRef like you mentioned. Like wxi, would I have to include the OutputFile.wxs? – Shintaro Takechi Jun 09 '16 at 21:39

1 Answers1

1

In my wix projects where I do harvest directories, I have the the harvest output file linked into my main wixproj like this:

<ItemGroup>
  ...
  <Compile Include="Components\HeatOutput.wxs">
    <Link>Components\HeatOutput.wxs</Link>
  </Compile>
  ...
</ItemGroup>

And this gets the file automatically linked into the build process by candle and light when building the wixproj. You can also add the files through visual studio; right click the wixproj -> Add -> Existing file -> pick Output.wxs and click the small arrow on the "Add" button and select "Add as link".

From the Output.wxs contents it looks like the issue may be

<DirectoryRef Id="ReferenceProject.Binaries">

You should be able to define DirectoryRefId in your HeatProject task and set it to the Directory Id of the location you want the components to install. You can also define SuppressUniqueIds="true" to get real names instead of "cmp4449C9C84D65952451BBDF1488B8BE48" and "fil72052E64CE55C9B2516044DF15A1F318"

I would also suggest opening the output's MSI in Orca and verify the component is defined in the Components table. You can also check which Directory it is installing to. In the Directory table you can see where that Directory points to as well.

If this doesn't give any insight into where your component is going/why it isn't installed. I would run the msi from the command line; msiexec /i <MsiFile>.msi /l*v Logfile.txt

The log should list your component and whether or not it is being installed and where it is being installed.

Brian Sutherland
  • 4,698
  • 14
  • 16
  • Thank you very much for following up Brian. I appreciate your insights. It seems like DirectoryRefId is parameter only available to HeatDirectory. I guess I should ask if it is better course of action to change my question and ask if I should use HeatDirectory instead of HeatProject? – Shintaro Takechi Jun 10 '16 at 16:24
  • Also checked Orca and sure enough the exe is not there. – Shintaro Takechi Jun 10 '16 at 16:26
  • For HeatProject you can use AdditionalOptions="-dir " to add the -dir option I think. If the exe is not there at all I think you need to link the output by including it as a linked file in your wixproj. Very odd that you don't get the file added to the MSI yet the compiler doesn't complain about missing references. – Brian Sutherland Jun 10 '16 at 17:19
  • In Orca, is the feature containing the exe listed in the Feature table? In FeatureComponents, does that feature contain the names of the components in your ourput.wxs? – Brian Sutherland Jun 10 '16 at 17:26
  • It is complaining about Unresolved reference to symbol 'Directory:ReferenceProject.Binaries' in section 'Fragment:' `` this is my new HeatProject. Even though I have added the APPLICATIONFOLDER (which is defined in my main wxs) – Shintaro Takechi Jun 10 '16 at 21:57
  • Should the command you suggested suppose to add attribute to the `` tag? When I add those ComponentGroup manually, I do add Directory there... – Shintaro Takechi Jun 10 '16 at 21:59
  • I am not sure. I'll try out a test project tomorrow to see if I can get the task to work. – Brian Sutherland Jun 12 '16 at 20:26
  • Thank you very much for your assistance Brian! – Shintaro Takechi Jun 14 '16 at 15:27