The idea behind fragments is that they supply blocks of authoring (aka code) that are included or excluded as units. They allow you to build entire libraries of authoring that are at your disposal without having to have all of them included. Only those fragments that contain elements referenced from some other fragment already included in the final output will actually be included, thus keeping the size of your installation package to an absolute minimum and permitting you to include/exclude features quite easily. It works much the same way as the C/C++ linker including or excluding modules.
In your case, the SetProperty element creates a custom action called "Set"+value-of-Id-attribute, or in your case, "Setuse_proxy". Thus, in your Product.wxs file, all you need is a <CustomActionRef Id="Setuse_proxy"/> element. You don't need to create an additional custom action just to reference your fragment. You can get rid of "Foo". -----Original Message----- From: Elfe Xu [mailto:elf...@microsoft.com] Sent: Saturday, June 26, 2010 12:54 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Is this the right way to use Fragment? Hi, I have some SetProperty code need to be executed after LaunchCondition, e.g. <SetProperty Id="use_proxy" Value="1" After="LaunchConditions" Sequence="ui"><![CDATA[PROXY_SERVER <> ""]]></SetProperty> To make the Product.wxs file clean, I added a new file Prepare.wxs, and move the SetProperty code into that file, under the Fragment element. However, I found the SetProperty does not get executed when I put it in Prepare.wxs, but it works when in Product.wxs. I checked the document, and found: The contents of a Fragment element can be linked into a product by utilizing one of the many *Ref elements. So I add a <CustomeAction Id="Foo" ...> to Prepare.wxs, and in the Product.wxs, use <CustomActionRef Id="Foo"> Everything works fine now, but I have little concern, because it seems strange to me that the final result is based on some cheating element. Am I doing right, or there is some recommended way for this? Thanks, -Elfe ---------------------------------------------------------------------------- -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users