Frage

I created a library in WiX with a single ComponentGroup, Component and File, this way:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
  <ComponentGroup Id="MyComponentGroup" Directory="WindowsFolder">
    <Component Id="MyComponent" Guid="...">
      <File Id="MyFile" Source="file.txt" KeyPath="yes" />
    </Component>
  </ComponentGroup>
</Fragment>
</Wix>

Then I created a WiX project, added a reference to this library (as a project reference) and I'm using this code:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="My Product" Language="1033"
         Version="1.0.0.0" Manufacturer="Myself"
         UpgradeCode="xxxxx">
  <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

  <Feature Id="Feature_Product" Title="Main Product"
         Level="1" Absent="disallow" Description="Core functionality.">
    <ComponentGroupRef Id="MyComponentGroup" />
  </Feature>
</Product>

<Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="WindowsFolder" />
  </Directory>
</Fragment>
</Wix>

But I'm receiving an error of Unresolved reference. Is there anything I'm missing? Or do libraries only work with UI and not files?

EDIT:

I added the complete code.

And it works if I use a FeatureRef and I move the Feature to the library, but I would like to keep the Feature in the main project and only have the Component in the library.

War es hilfreich?

Lösung

You haven't posted your entire error, but the error I get when using your example is:

Unresolved reference to symbol 'Media:1' in section 'Fragment:'

The unresolved reference is a missing media element; the File needs to be stored in a cabinet and it defaults to File/@DiskId="1" which is why it's looking for "Media:1". You need to tell WiX where to store the installation files. If you're using WiX 3.7, add this into your <Package> element:

<MediaTemplate EmbedCab="yes" />

If you're using an earlier version:

<Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes" />
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top