Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference File element inside wxs file generated by heat.exe in Wix

Tags:

I am going to create setup for my web project. I use http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/ as my reference. In the middle of article, author create a file called WebSiteContent.wxs using heat.exe:

<Target Name="Harvest">
<!-- Harvest all content of published result -->
<Exec
    Command='$(WixPath)heat dir $(Publish) -dr INSTALLFOLDER -ke -srd -cg MyWebWebComponents -var var.publishDir -gg -out $(WebSiteContentCode)'
    ContinueOnError="false"
    WorkingDirectory="." />
</Target>

After runnig msbuild, file conitains following content:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <!--...-->
  <Fragment>
    <ComponentGroup Id="MyWebWebComponents">
      <!--...-->
      <Component Id="cmpCDB7F4EFDEF1E65C3B12BEBAD7E4D7EA" Directory="INSTALLFOLDER" Guid="{7EA5DB39-513D-482B-9FDC-2F16FCE5E712}">
        <File Id="fil8994620207C22CA15AF75ACDD6420C79" KeyPath="yes" Source="$(var.publishDir)\Web.config" />
      </Component>
    </ComponentGroup>
  <!--...-->
  </Fragment>
</Wix>

I want to change value of web.config file content as described in Change XML node values from WiX but I don't know how to add reference outside of WebSiteContent.wxs file to fil8994620207C22CA15AF75ACDD6420C79 element.

I know I can add xml script to WebSiteContent.wxs file. But because in every build it will be cleaned, I don't want to change WebSiteContent.wxs file in every build.

like image 442
Seyed Morteza Mousavi Avatar asked Apr 15 '16 11:04

Seyed Morteza Mousavi


1 Answers

Use the file id with the # prefix in a property as shown in the example you referenced. File ids generated by heat are stable with respect to their location specification.

If that makes it unreadable, you can give heat and XSL to change the file id to a fixed value.

like image 94
Tom Blodget Avatar answered Nov 15 '22 07:11

Tom Blodget