Josh
Josh

Reputation: 760

Wix toolset not delivering file

We use heat to generate wix code to deliver files in the same hierarchy as the project. We recently decided to change the delivery location of some tutorial and documentation files, but I'm having an issue with wix just refusing to deliver files. I changed the build action from 'content' to none so that heat would ignore these files and and manually editing the product.wxs file to deliver these files to the specified location as we don't want to move them in source control and risk losing version history, etc.

my directory structure (CustomerDirectory and ProgramDirectory are placeholder names for confidentiality):

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="$(var.PlatformProgramFilesFolder)">
    <Directory Id="CustomerDirectory" Name="Customer">
      <Directory Id="INSTALLFOLDER" Name="ProgramName">
        <Directory Id="ResourcesFolder" Name="Resources">
          <Directory Id="DocumentationFolder" Name="Documentation"/>
          <Directory Id="TutorialsFolder" Name="Tutorials"/>
        </Directory>
      </Directory>
    </Directory>
  </Directory>

and the below fragment located at the bottom of product.wxs

<Fragment>
  <ComponentGroup Id="DocumentationComponents" Directory="DocumentationFolder">
    <Component Id="Installation_Guide.pdf">
      <File Id="Installation_Guide.pdf" Source="$(var.GUI.ProjectDir)\Documentation\Installation Guide.pdf" KeyPath="yes"/>
    </Component>
  </ComponentGroup>
</Fragment>

I've played around with KeyPath, GUID, and many other possibilities with no luck. I just recently added log4net assemblies to this file and they are getting delivered no problem, using basically the same code posted here.

Upvotes: 0

Views: 210

Answers (1)

Josh
Josh

Reputation: 760

Delivering a "Content" file to a different location other than where heat wanted to put it turned out to be extremely difficult. With enough digging around I might have found a solution within Wix. Unfortunately, Wix is not intuitive at all, not very well though out from conception, and I've seen better documentation on a chinese made filing cabinet. Unfortunately many of us still have to use this forsaken product, so if you run into a similar issue THIS IS WHAT I SUGGEST:

  1. any files u want to deliver elsewhere, change their build action to "none"so heat no longer includes them in the .wxs file it generates.
  2. create an xml that hold all the Component, ComponentRef, File, and Directory elements that you will need to insert into the heat generated file. (if you manually change heat generated file it will just get overwritten later. We will use a powershell file that runs every time after you generate the heat file and inserts these xml elements into the heat generated file with whatever directory structure or destination for the files that you want(which means you are no longer limited to the project hierarchy for installs and can change where files get installed without changing location of files in source control.)
  3. Create the powershell file that opens the heat generated file and opens the xml file then imports nodes and inserts them into the heat generated file. Save the heat generated file after xml insertion.
  4. Create a batch file that runs heat.exe to generate the .wxs file, on the next line call your powershell file that opens the .wxs and the .xml and transfers the xml nodes from your xml to the .wxs file.
  5. Save it

Upvotes: 1

Related Questions