Hi Wix users,

 

I don't know if the behaviour I am about to describe is a bug or by
design.  Any guidance would be appreciated.


We are using heat to generate a number of fragments that are referenced
by the Wix Project\Votive (Wix build 3.6.1502).  Part of the
installation requirements is for the installation paths to be alterable
by reading a file, so we are using an ini file in the Windows folder.
Heat generates a number of fragments when arriving at a final file, and
we post process this file to add a Property to be set for the location
plus an IniFileSearch element.  While I know that there are a couple of
workarounds for the problem (stated below), I don't understand why what
we had does not work.

 

 

What we had:

Project .wxs

 

<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>

       <Product Id="6b599ac4-b816-4ef6-b995-2fe3d3764c64"
Name="TestPropertyInFragmentBug" Language="1033" Version="1.0.0.0"
Manufacturer="TestPropertyInFragmentBug"
UpgradeCode="a2f4e38d-6ae6-47d3-822f-e0aa5a03cd1d">

              <Package InstallerVersion="200" Compressed="yes" />

              <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

 

              <Directory Id="TARGETDIR" Name="SourceDir">

                     <Directory Id="ProgramFilesFolder">

                           <Directory Id="INSTALLLOCATION"
Name="TestPropertyInFragmentBug">

          <Directory Id="FRAGMENTDIR" />

                           </Directory>

                     </Directory>

              </Directory>

 

              <Feature Id="ProductFeature"
Title="TestPropertyInFragmentBug" Level="1">

                     <ComponentGroupRef Id="Fragment.Group" />

              </Feature>

       </Product>

</Wix>

 

 

And an automatically altered, heat generated fragment, basically:

 

<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>

  <Fragment>

    <DirectoryRef Id="FRAGMENTDIR" />

    <Property Id="FRAGMENTDIR" >

      <IniFileSearch Id="FragmentDir.Property.Ini" Key="FragmentDir"
Name="Fragment.ini" Section="Dirs" Type="raw" />

    </Property>

  </Fragment>

  <Fragment>

    <ComponentGroup Id="Fragment.Group" >

      <Component Id="FragmentFile.Component" Directory="FRAGMENTDIR">

        <File Id="Test.File" KeyPath="yes" Source="C:\Test.txt" />

      </Component>

    </ComponentGroup>

  </Fragment>

</Wix>

 

Now this will compile and an MSI built.  What happens at runtime though
is that the ini file search never happens and the directory used is
always the default.  I noticed that the AppSearch table was not present
in the MSI.

 

I have found 2 workarounds.  Firstly I can put the Property element into
the same fragment as the component group.  The AppSearch table is part
of the MSI & things work.

Alternatively, I can leave the two fragments, and alter the DirectoryRef
element, adding a child Directory element, such as:

      <Directory Id="FragmentDir.Property" />

 

And then change the Directory attribute of the file's component to be
FragmentDir.Property.  Then the MSI will have the AppSearch table and
the location of the file will be changed.

 

    <ComponentGroup Id="Fragment.Group" >

      <Component Id="FragmentFile.Component"
Directory="FragmentDir.Property">

        <File Id="Test.File" KeyPath="yes" Source="C:\Test.txt" />

      </Component>

    </ComponentGroup>

 

Is this a bug?

 

 

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to