5

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.

Community
  • 1
  • 1
Seyed Morteza Mousavi
  • 6,855
  • 8
  • 43
  • 69

1 Answers1

4

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.

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • 1
    Thanks for your help. Can you help me how I can add it to Product.wxs file? In which tag? – Seyed Morteza Mousavi Apr 17 '16 at 05:43
  • 1
    @TomBlodget can you give an example of this because this appears to be invalid syntax. I've used something like ** – Ultratrunks Dec 08 '16 at 20:23
  • @SeyedMortezaMousavi @Ultratrunks He meant you can retrieve the **file path** by using the tag `[#fil8994620207C22CA15AF75ACDD6420C79]`. See [#filekey](https://msdn.microsoft.com/en-us/library/windows/desktop/aa368609.aspx). – Roi Danton Nov 29 '17 at 15:22