Or use Burn and a managed BA, where you can do it without a CA and pass it as a 
property to the MSI.

-----Original Message-----
From: Davis, Jeff [mailto:jda...@nanometrics.com] 
Sent: Friday, February 27, 2015 11:07 AM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] using a custom action to read properties from a XML 
file

Jeremiahf,

I like your approach.  I'll write the C# code to do what I want it to do and 
then figure out how to make it a CA.  Instead of trying to write a CA to do 
what I want.

Jeff


-----Original Message-----
From: Jeremiahf [mailto:jeremi...@gmail.com]
Sent: Thursday, February 26, 2015 6:49 PM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] using a custom action to read properties from a XML 
file

I've had to do this before. My method was to create an application to 
read/modify an XML file. Then took my code and turned it into a CA. Saved a lot 
of headache trying to debug what was going on. Also as John stated, scheduled 
the CA to execute first.

J

On Thu, Feb 26, 2015 at 5:37 PM, John Cooper <jocoo...@jackhenry.com> wrote:

> Ok, so, you'll need to run in the UI Sequence pretty early.
>
> Question, how does "Va'lue" set MAC_ID?  Normally, I would expect "Value"
> to be replaced by "MAC_ID".
>
> You'll need to add an
>
> <InstallUISequence>
>
> Element with a <Custom Action="your XML setter entry point here"
> Before="LaunchConditions" />
>
> What does your entry point look like?
>
> --
> John Merryweather Cooper
> Senior Software Engineer | Integration Development Group | Continuing 
> Development Jack Henry & Associates, Inc.® | Lenexa, KS  66214 | Ext:
> 431050 | jocoo...@jackhenry.com
>
> -----Original Message-----
> From: Davis, Jeff [mailto:jda...@nanometrics.com]
> Sent: Thursday, February 26, 2015 5:27 PM
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] using a custom action to read properties from 
> a XML file
>
> I have custom UI dialog that has a Text control that has the variable.
> When the MSI runs it should populate that field with the data read 
> from the XML.
>
>         <Control Type="MaskedEdit" Id="MacID" Width="270" Height="15"
> X="52" Y="184" Property="MAC_ID"  Text="[MACIDTemplate]"   />
>         <Control Type="Text" Id="MacIDLabel" Width="36" Height="10" X="11"
> Y="188" Text="MAC ID" />
>
>
>
> -----Original Message-----
> From: John Cooper [mailto:jocoo...@jackhenry.com]
> Sent: Thursday, February 26, 2015 3:08 PM
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] using a custom action to read properties from 
> a XML file
>
> Well, which sequence is the custom action running?  UI or Execute?  If 
> in the execute sequence, only public secure properties (properties in 
> all upper case with a Secure="yes" attribute) will be visible in the 
> UI sequence.  If in the UI sequence, are you firing this from a button, or is
> it just scheduled?   If from a button, you're not going to get any
> logging.  Try scheduling in directly in UI so you can get some logging.
>
> --
> John Merryweather Cooper
> Senior Software Engineer | Integration Development Group | Continuing 
> Development Jack Henry & Associates, Inc.® | Lenexa, KS  66214 | Ext:
> 431050 |jocoo...@jackhenry.com
>
> -----Original Message-----
> From: Davis, Jeff [mailto:jda...@nanometrics.com]
> Sent: Thursday, February 26, 2015 4:54 PM
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] using a custom action to read properties from 
> a XML file
>
> Nothing happens.   The value does not get populated in the UI.  It still
> shows the default value of 0.
>
> But I am really just coding in the dark on this.  I'm not sure what I am
> doing and not even sure I have everything correct.   I just don't get the
> whole custom action concept and how properties get read and set?
>
> This was just a stab at what I thought would work.
>
> Jeff
>
>
> -----Original Message-----
> From: John Ludlow [mailto:john.ludlow...@gmail.com]
> Sent: Thursday, February 26, 2015 2:33 PM
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] using a custom action to read properties from 
> a XML file
>
> When you say "not working", what do you mean exactly? Is it just not 
> calling your CA, not finding the file, not getting any results, or is 
> it throwing an exception?
>
> Here are some things you can try:
>
> Check whether there any evidence in the log that the custom action has 
> been called, and what the CustomActionData is. Also, put a few 
> session.Log calls in strategic places in the code to see where it's getting 
> to.
>
> Try writing similar code in a console application and seeing whether 
> it can load the XML file
>
> And of course, the "real" way :
>
> http://blog.torresdal.net/2008/10/26/wix-and-dtf-debug-a-managed-custo
> m-action-and-how-to-generate-an-msi-log/
>
> Here are some possible theories:
>
> If the custom action data is what you have there, I would suggest that 
> the relative path isn't being evaluated from where you think it would 
> be - you may need to use a property to build up a full path to the file.
>
> Is it possible that the XML file has a namespace? If the document has 
> a namespace and you don't handle that in your code (both in the C# and 
> in the
> XPath) you won't get any results.
>
> Hope that helps
>
> John
>
> On 26 February 2015 at 21:32, Davis, Jeff <jda...@nanometrics.com> wrote:
>
> > I am having a heck of time trying get my mind wrapped around the way 
> > to create and use a custom action in my C# Wix Project in Visual 
> > Studio
> 2013.
> >
> > I want to be able to open a specified XML file and return an 
> > attribute from a specified key and then use that to initialized a 
> > property in the installer and display it in the dialog.  Then when 
> > installer is run
> it will
> > write the value to a target XML file to the same key and attribute.   In
> My
> > case I have a MAC_ID  Property that is in a UI text box that I want 
> > to initialize from a XML file attribute and then write to a new XML file
> > during the install.   The write is pretty straightforward since it is
> built
> > into WIx.  But I can't get the read working.
> >
> > I created this Custom Action
> >
> >     public class CustomActions
> >     {
> >         [CustomAction]
> >         public static ActionResult ReadXmlValue(Session session)
> >         {
> >             string fileName = session.CustomActionData["FileName"];
> >             string xmlnode = session.CustomActionData["Node"];
> >             string key = session.CustomActionData["Key"];
> >
> >             XmlDocument xmlDoc = new XmlDocument();
> >             xmlDoc.Load(fileName);
> >             if (xmlDoc.DocumentElement != null)
> >             {
> >                 XmlNodeList nodeList = 
> > xmlDoc.DocumentElement.SelectNodes(xmlnode);
> >
> >                 if (nodeList != null)
> >                     foreach (XmlNode node in nodeList)
> >                     {
> >                         var selectSingleNode =
> node.SelectSingleNode(key);
> >                         if (selectSingleNode != null) 
> > session["Value"] = selectSingleNode.InnerText;
> >                     }
> >             }
> >
> >             return ActionResult.Success;
> >         }
> >     }
> >
> >
> > My WXS script looks like this
> >
> >
> >    <Property Id="MAC_ID" Secure="yes" Value="0"/>
> >     <Property Id="MACIDTemplate">
> >       <![CDATA[&&-&&-&&-&&-&&-&&]]>
> >     </Property>
> >
> >     <CustomAction Id="myActionId" BinaryKey="myAction"
> > DllEntry="ReadXMLValue" Execute="deferred" Return="check" />
> >     <CustomAction Id="SetCustomActionDataValue" Return="check"
> > Property="myActionId" Value="FileName='.\FilesToInstall\Program
> >
> Files\Zygo\MetroProX\cfg\NewView.IC.xml';Node='\Settings\Section\Section\Section\add';Key='Mac'"
> > />
> >     <CustomAction Id="ReadXMLValue" Property="Value" Value="[MAC_ID]"
> > />
> >
> >     <InstallExecuteSequence>
> >       <Custom Action="SetCustomActionDataValue"
> > Before="myActionId">NOT Installed</Custom>
> >       <Custom Action="myActionId" Before="InstallFinalize">NOT 
> > Installed</Custom>
> >     </InstallExecuteSequence>
> >
> >
> > But I don't think I have this setup right?
> >
> >
> > Jeff Davis
> >
> > --------------------------------------------------------------------
> > --
> > -------- Dive into the World of Parallel Programming The Go Parallel 
> > Website, sponsored by Intel and developed in partnership with 
> > Slashdot Media, is your hub for all things parallel software 
> > development, from weekly thought leadership blogs to news, videos, 
> > case studies, tutorials and more. Take a look and join the conversation now.
> > http://goparallel.sourceforge.net/
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
>
> ----------------------------------------------------------------------
> -------- Dive into the World of Parallel Programming The Go Parallel 
> Website, sponsored by Intel and developed in partnership with Slashdot 
> Media, is your hub for all things parallel software development, from 
> weekly thought leadership blogs to news, videos, case studies, 
> tutorials and more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> ----------------------------------------------------------------------
> -------- Dive into the World of Parallel Programming The Go Parallel 
> Website, sponsored by Intel and developed in partnership with Slashdot 
> Media, is your hub for all things parallel software development, from 
> weekly thought leadership blogs to news, videos, case studies, 
> tutorials and more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> NOTICE: This electronic mail message and any files transmitted with it 
> are intended exclusively for the individual or entity to which it is 
> addressed.
> The message, together with any attachment, may contain confidential 
> and/or privileged information.
> Any unauthorized review, use, printing, saving, copying, disclosure or 
> distribution is strictly prohibited. If you have received this message 
> in error, please immediately advise the sender by reply email and 
> delete all copies.
>
>
>
> ----------------------------------------------------------------------
> -------- Dive into the World of Parallel Programming The Go Parallel 
> Website, sponsored by Intel and developed in partnership with Slashdot 
> Media, is your hub for all things parallel software development, from 
> weekly thought leadership blogs to news, videos, case studies, 
> tutorials and more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> ----------------------------------------------------------------------
> -------- Dive into the World of Parallel Programming The Go Parallel 
> Website, sponsored by Intel and developed in partnership with Slashdot 
> Media, is your hub for all things parallel software development, from 
> weekly thought leadership blogs to news, videos, case studies, 
> tutorials and more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> NOTICE: This electronic mail message and any files transmitted with it 
> are intended exclusively for the individual or entity to which it is 
> addressed. The message, together with any attachment, may contain 
> confidential and/or privileged information.
> Any unauthorized review, use, printing, saving, copying, disclosure or 
> distribution is strictly prohibited. If you have received this message 
> in error, please immediately advise the sender by reply email and 
> delete all copies.
>
>
>
> ----------------------------------------------------------------------
> -------- Dive into the World of Parallel Programming The Go Parallel 
> Website, sponsored by Intel and developed in partnership with Slashdot 
> Media, is your hub for all things parallel software development, from 
> weekly thought leadership blogs to news, videos, case studies, 
> tutorials and more. Take a look and join the conversation now.
> http://goparallel.sourceforge.net/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored 
by Intel and developed in partnership with Slashdot Media, is your hub for all 
things parallel software development, from weekly thought leadership blogs to 
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored 
by Intel and developed in partnership with Slashdot Media, is your hub for all 
things parallel software development, from weekly thought leadership blogs to 
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to