Hi Blair,

Thank you for your help. I tried your suggestion and have a problem getting it 
work. Below is how the custom action, WriteModulesXml, is setup. This CA tries 
to access session.Features.

Declaration:
    <CustomAction Id="WriteModulesXml" BinaryKey="CustomAction1.dll" 
DllEntry="WriteModulesXml" Execute="immediate" Return="ignore" />

Sequence:
    <InstallExecuteSequence>
      <Custom Action="WriteModulesXml" After ="InstallInitialize">NOT 
REMOVE="ALL"</Custom>

Error:
Calling custom action CustomAction1!CustomAction1.CustomActions.WriteModulesXml
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the 
target of an invocation. ---> 
Microsoft.Deployment.WindowsInstaller.InvalidHandleException: The handle is 
invalid.
   at Microsoft.Deployment.WindowsInstaller.FeatureInfo.get_Description()
   at CustomAction1.CustomActions.WriteModulesXml(Session session)

I tried scheduling this CA in difference places but got the same error. Any 
idea?

Thanks a lot,
Miaohsi

-----Original Message-----
From: Blair Murri [mailto:os...@live.com] 
Sent: Wednesday, July 10, 2013 6:45 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] How can I loop through in C# custom action the Feature 
tree and detect the install state and install action for each one of the 
features?

I would assume:
foreach (FeatureInfo FeatureState in session.Features)
{
    FeatureInfo.Name; // etc.
}
 
> From: miaohsi.w...@invensys.com
> To: wix-users@lists.sourceforge.net
> Date: Wed, 10 Jul 2013 16:05:48 -0400
> Subject: [WiX-users] How can I loop through in C# custom action the Feature 
> tree and detect the install state and install action for each one of the 
> features?
> 
> Dear All,
> 
> I am trying to find a way to loop through the Feature tree and detect the 
> install state and install action for each one of the features in my C# custom 
> action. Below is what I've found that I could use:
> 
> FeatureInfo FeatureState = session.Features["feature_name"];
> 
> >From the FeatureState I can find out the install state/action of the 
> >feature, but I'll have to explicitly write the same code for each feature in 
> >the feature tree. Is there a way I can simply get the feature tree and loop 
> >through it?
> 
> Thanks a lot,
> Miaohsi
> 
> 
> 
> *** Confidentiality Notice: This e-mail, including any associated or attached 
> files, is intended solely for the individual or entity to which it is 
> addressed. This e-mail is confidential and may well also be legally 
> privileged. If you have received it in error, you are on notice of its 
> status. Please notify the sender immediately by reply e-mail and then delete 
> this message from your system. Please do not copy it or use it for any 
> purposes, or disclose its contents to any other person. This email comes from 
> a division of the Invensys Group, owned by Invensys plc, which is a company 
> registered in England and Wales with its registered office at 3rd Floor, 40 
> Grosvenor Place, London, SW1X 7AW (Registered number 166023). For a list of 
> European legal entities within the Invensys Group, please select the Legal 
> Entities link at invensys.com.
> 
> 
> You may contact Invensys plc on +44 (0)20 3155 1200 or e-mail 
> recept...@invensys.com. This e-mail and any attachments thereto may be 
> subject to the terms of any agreements between Invensys (and/or its 
> subsidiaries and affiliates) and the recipient (and/or its subsidiaries and 
> affiliates).
> 
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
                                          
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


*** Confidentiality Notice: This e-mail, including any associated or attached 
files, is intended solely for the individual or entity to which it is 
addressed. This e-mail is confidential and may well also be legally privileged. 
If you have received it in error, you are on notice of its status. Please 
notify the sender immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any other person. This email comes from a division of the Invensys 
Group, owned by Invensys plc, which is a company registered in England and 
Wales with its registered office at 3rd Floor, 40 Grosvenor Place, London, SW1X 
7AW (Registered number 166023). For a list of European legal entities within 
the Invensys Group, please select the Legal Entities link at invensys.com.


You may contact Invensys plc on +44 (0)20 3155 1200 or e-mail 
recept...@invensys.com. This e-mail and any attachments thereto may be subject 
to the terms of any agreements between Invensys (and/or its subsidiaries and 
affiliates) and the recipient (and/or its subsidiaries and affiliates).



------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to