Reputation: 735
I have a WIX installer that uses custom actions defined in a WXS file as part of the install process to add setting values into the registry.
I am trying to automate the addition of new settings into the installed by generating the XML used to define the custom actions using a C# app, saving the generated XML into a number of XML files, and then referencing these XML files within the WXS file using the following syntax
<!DOCTYPE Wix [
<!ENTITY externalCustomActionList SYSTEM "customActionList.xml">
<!ENTITY ExternalPropertyList SYSTEM "customActionPropertyList.xml">
]>
I have discovered through trial and error that Visual Studio will pick up errors in the external XML files and not compile correctly, so I know that when I compile and get an installer built that the XML itself is ok.
The problem is that the custom actions within the external XML file does not get executed when running the installer.
If I paste the generated XML straight into the WXS file the installer runs correctly and as I expect it to.
Is it possible to build up a WIX custom Actions WXS file using XML chunks from external files in this way?
The reason I want to build up the custom actions in this way is to avoid having to change the main WIX files with my little C# app when adding new settings in.
Upvotes: 0
Views: 564
Reputation: 735
I have been working on this further and was able to include Fragments of WIX XML from other files by giving each fragment a dummy Property and using the PropertyRef tag in the Product.wxs file.
The top of my additional files is as follows:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Property Id="CustomActionsList" Value="1" />
Any XML I add in goes inside the Fragment definited, which is then included in the WiX installer when the Property is referred in Product.wxs as follows:
<PropertyRef Id="CustomActionsList"/>
This has given me the desired effect of being able to pull in auto generated XML into my WIX installer.
I have also been able to add Components in the same way but using Component
and ComponentRef
intead of Property
and PropertyRef
Upvotes: 4