Question

I've come across several sources stating to split up a WiX installation file into the separate parts (variables, components, etc.) using include files (.wxi). Makes perfect sense to me, so I took the <components> nodes out of the .wxs file and put them in a separate file, but when I attempt to compile the project in Visual Studio 2008 I get an error for each <ComponentRef> stating it's an "Unresolved reference to symbol '...' in section 'Product:{...}'".

I've tried using the <?include "Filename"?> tag in my Product.wxs file, but that seems to break the schema validation. If that's the way to include it, where does it need to go?

The files I have are the following.

Product.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product ...>
    <Package .../>
    <Media .../>
    <Directory Id="TARGETDIR" Name="SourceDir">
    </Directory>
    <Feature Id="MainProgram" Level="1">
      <ComponentRef Id="ProductComponent" />
      <Feature Id="ContextMenu" Level="2">
        <ComponentRef Id="ContextMenuComponent" />
      </Feature>
    </Feature>
  </Product>
</Wix>

Components.wxi

<?xml version="1.0" encoding="utf-8"?>
<Include>
  <Fragment>
    <Component Id="ProductComponent" ...>
      <File .../>
    </Component>
    <Component Id="ContextMenuComponent" ...>
      <RegistryKey .../>
    </Component>
  </Fragment>
</Include>

How do I get it to build in Visual Studio? Scripting the build seems simpler, but not an issue of mine just yet.

Was it helpful?

Solution

Include files should be thought of as header files, you really only want to use them to declare common variables, etc that you need to share between multiple .wxs files.

My project uses ~10 .wxs files and a single .wxi that I define the product code, upgrade code, etc in.

For a better idea of what I'm talking about check out the SO questions Wix Tricks & Best Practices and WiX Includes vs. Fragments as well, as always, the documentation in Wix.chm

OTHER TIPS

Try using the WXS extension rather than WXI. I have broken mine up and used WXS as the extension, and it just worked. All WXS files in the project are passed into the wix compiler by the wixproj.

Found this question searching for my problem and I figured i'd add my fix incase someone came from where I did.

If you're using a wixproj file to compile from Visual Studio, it seems that this project type doesn't support file links (Add exising item...Add as link). You'll end up with the links in your project but when you compile it will complain that there are unresolved symbols.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top