bigmac
bigmac

Reputation: 2563

Moving Feature to a Fragment Throws Error

I am new to WiX, but I have one issue that I can't figure out. I have the following code which "installs" fine (basically it just adds a text file to the Program Files folder).

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="WixTemplate" Language="1033" Version="1.0.0.0" Manufacturer="My Company" UpgradeCode="d7c4cfc2-4e50-4002-9273-e900112e2b03">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes"/>
    <Feature Id="ProductFeature" Title="WixTemplate" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixTemplate" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="TextFileComponent">
        <File Id="FooTxt" Source="foo.txt" />
      </Component>
    </ComponentGroup>
  </Fragment>

</Wix>

However, if I move the Feature section to its own Fragment, it compiles fine, but when I run it with logging, it fails with an overall "Installation success or error status: 1603" and the first error value of 3 indicating "Note: 1: 2205 2: 3: ActionText" meaning that the ActionText table was not found.

Here is the code that fails to install:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="WixTemplate" Language="1033" Version="1.0.0.0" Manufacturer="Blue Ribbon Technologies, LLC" UpgradeCode="d7c4cfc2-4e50-4002-9273-e900112e2b03">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes"/>
  </Product>

  <Fragment>
    <Feature Id="ProductFeature" Title="WixTemplate" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
  </Fragment>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixTemplate" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="TextFileComponent">
        <File Id="FooTxt" Source="foo.txt" />
      </Component>
    </ComponentGroup>
  </Fragment>

</Wix>

So what's special about the Feature section that it can't be a fragment where Components and Directories can?

Upvotes: 0

Views: 48

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21896

Nothing in your Product references the Feature. WiX won't link in a Fragment unless something references a resource in it. Add a FeatureRef to your Product to pull in the Feature which will in turn pull in the ComponentGroup which pulls in the Component.

Upvotes: 2

Related Questions