Using WXI Files in Visual Studio WiX Project

I came across several sources that talk about splitting the WiX installation file into separate parts (variables, components, etc.) using include files (.wxi). The idea is completely clear to me, so I took the <components> nodes from the .wxs file and put them in a separate file, but when I try to compile the project in Visual Studio 2008, I get an error for each <ComponentRef> stating that it is " Unauthorized reference to the symbol "..." in the section "Product: {...}".

I tried using <? include "Filename"? > tag in my Product.wxs file, but this seems to break the schema check. If this is a way to turn it on , where should it go?

The files that I have are as follows.

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 create it in Visual Studio? The build script seems simpler, but not a problem yet.

+4
source share
3 answers

The inclusion of files should be considered as header files, you really want to use them to declare common variables, etc. that you need to share between several .wxs files.

My project uses ~ 10.wxs files and one .wxi, which I define product code, update code, etc.

For a better understanding of what I'm talking about checking SO questions, Wix Tricks and Best Practices and WiX Also includes snippets , as always, documentation in Wix.chm

+11
source

Try using the WXS extension rather than WXI. I broke mine and used WXS as an extension, and it just worked. All WXS files in the project are transferred to the wix compiler using wixproj.

+4
source

I found this question to find my problem, and I decided that I would add that someone came from where I did.

If you use the wixproj file to compile from Visual Studio, it seems that this type of project does not support file links (adding output element ... Add as link). You will get links in your project, but when compiling it will complain about the presence of unresolved characters.

0
source

All Articles