1
votes

I have multiple wxs files that are generated by heat.exe. Each file has a root element Wix, two children Fragment, and each of the Fragment elements have a DirectoryRef and ComponentGroup element respectively. Sample is hereunder:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="ANEXMCM">
            <Component Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" Guid="2924A2A0-D7A2-407E-B9B8-B40AAE1204ED">
                <File Id="filABF39DC4BC6ED4474A2C2DB1C1681980" KeyPath="yes" Source="SourceDir\content.txt" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ANEXMCM_CID">
            <ComponentRef Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" />
        </ComponentGroup>
    </Fragment>
</Wix>

I included the files to the main WIX file as <?include wixfile.wxs?> . When I tried to build my project ( I tried on both Visual Studio and SharpDevelop, I even tried the command line), the error I get is "The document element name 'Wix' is invalid. A Windows Installer XML include file must use 'Include' as the document element name. (CNDL0048) - C:\WorkingDir\anexmcmsetup.wxs:2". I don't how to get this error fixed. I appreciate your immediate help. Thanks!

2
What command line was used to generate the wxs files with heat.exe?Rami A.

2 Answers

5
votes

I had a similar problem and it was because I wasn't implementing fragments correctly...

A good basic explanation of fragments can be found here...

http://wix.tramontana.co.hu/tutorial/upgrades-and-modularization/fragments

In my instance

In my specific scenario I had split my installer into two wxs files.

  1. Product.wxs - main xml file)
  2. FilesFragment.wxs - xml file containing all the files I got from heat).

Where I went wrong was that I thought I needed to have some sort of include reference in Product.wxs that would reference to FilesFragment.wxs. Similar to how you would do in a c++ project. For instance I assumed if I wanted to include a additional wxs file called wixfile.wxs in my main installation I would need some sort of

<?include wixfile.wxs?>

This was an incorrect assumption. This relationship is set up in your project file (ending with .wixproj), by virtue of having it there, it knows the file exists.

In the Product.wxs file I then needed to set up a Feature that had a ComponentGroupRef with an Id that referenced the ComponentGroup ID in my FilesFragment.wxs file.

Example of file contents...

Product.wxs file

 <Feature Id="ProductFeature" Title="Setup MaxCut" Level="1">
  <ComponentGroupRef Id="FilesFragment" />
</Feature>

FilesFragment.wxs file

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <DirectoryRef Id="APPLICATIONFOLDER">
        <Component Id="xyz" Guid="{abc...}">
            <File ... />
        </Component>
    ...       
    </DirectoryRef>
</Fragment>
...

<Fragment>
    <ComponentGroup Id="FilesFragment">
        <ComponentRef Id="xyz" />
    </ComponentGroup>
</Fragment>

This achieved what I needed. I think it is what you are trying to do as well?

2
votes

I had the same error message for an included xws-File. I changed the build action for this file from "Compile" to "None" and the error disappeared.