A feature's condition is evaluated during CostFinalize, so if you are going to set/modify a property that you intend to affect that, your custom action must run BEFORE CostFinalize to prevent that feature from being installed. Before InstallFiles is way too late.
CostFinalize is in both InstallExecuteSequence AND in InstallUISequence, so you will need your custom action in both sequences. Generally with this type of setup you want your property to be marked "Secure" and your action to be marked @Execute='oncePerProcess', but that is really up to you. BTW, updating the Property table does not necessarily mean that the property will exist when you attempt to use it in a condition (you may have modified the table long after the table was processed and the session properties created from that table). Further, your modifications to that table will not be there when the database is opened for repair or removal. In general, modifying the Property table during an installation turns out to be a waste of time. You would probably be better off just setting the session property directly. -----Original Message----- From: William Prada [mailto:b...@sorna.com] Sent: Thursday, September 17, 2009 9:27 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Controling features installed with custom actions C# Hello, I would like to use a custom action to read a license file and base the installed features on its contents. I have a custom action written in C# that successfully inserts a new entry into the Property table: using (View propertyView = session.Database.OpenView("SELECT * FROM Property")) { Record propertyRec = new Record(2); propertyRec[1] = "PRODUCT_VER"; propertyRec[2] = "XYZ_VER"; propertyView.Modify(ViewModifyMode.InsertTemporary, propertyRec); } In my Product.wxs file I have this to specify the custom action and when it is executed: <CustomAction Id="CASetProductVer" BinaryKey="SupportCAs" DllEntry="SetProductVer" Execute="immediate" /> <InstallExecuteSequence> <Custom Action="CASetProductVer" Before="InstallFiles"/> </InstallExecuteSequence> And finally, I only want to install the XYZ version of the product when Property PRODUCT_VER=XYZ_VER: <CustomAction Id="CASetProductVer" BinaryKey="SupportCAs" DllEntry="SetProductVer" Execute="immediate" /> <InstallExecuteSequence> <Custom Action="CASetProductVer" Before="InstallFiles"/> </InstallExecuteSequence> <Feature Id="XYZVer" Title="Product XYZ Ver" Level="1"> <Condition Level="0">CData<![CDATA[PRODUCT_VER<>"XYZ_VER]]> "</Condition> <ComponentRef Id="XYZ_VER_REF"/> </Feature> My thought was that by setting the value of Property PRODUCT_VER during the custom action to anything other than XYZ_VER would cause the install level of Feature XYZ to 0 and prevent its installation. I have tried various ways of expressing the inside text of the condition element but cannot prevent the installation of Feature XYZ_VER. I'd appreciate any guidance you could give on this. Best, Bill Prada ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users