Everyone,

I apologize for not getting back sooner with updates on this issue, but I was 
able to find a solution.  I had to do two things:

    * Set up subfeatures to point to APPDATADIR where applicable from the 
original example below instead of TARGETDIR as their configurable directory.  
This can be changed via attributes under the <Feature> tag; and
    * Use the SetTargetPath action at the appropriate times (normally off of 
dialog button controls) to make sure APPDATADIR was correctly set during 
certain actions in the UI.  These can be set through events under the <Publish> 
tag.

There was one caveat: I had to sometimes set APPDATADIR to a temporary value 
before using SetTargetPath, i.e., [WindowsVolume]temp or  C:\temp\ .  Then I 
would change APPDATADIR to the desired directory to have the subdirectories 
recalculated by SetTargetPath.  I think this occurred if I had set APPDATADIR 
to TARGETDIR and then attempted to change it to another value.  In other words, 
APPDATADIR had to change from TARGETDIR -> C:\temp\ -> (new directory of 
choice).  Without the C:\temp\ change, APPDATADIR would change but the 
subdirectories would not be recalculated.  I believe that issue prevented me 
from getting the SetTargetPath action to work correctly in all cases, making me 
lean towards a custom action. I could look into why that extra directory change 
is necessary in that case, but I do not feel the urge to look a gift horse in 
the mouth at this time. :)

Thank you again for all your assistance in this matter.  I hope this helps 
anyone else who may attempt to do something like this.

David J. Antoine
Quality Assurance
ConvergEx Group | RealTick
100 S. Wacker Drive, 20th Floor
Chicago, IL 60606
T: 312.442.8673 | F: 312.960.4729
danto...@realtick.com


-----Original Message-----
From: Antoine, David [mailto:danto...@realtick.com]
Sent: Friday, February 11, 2011 11:36 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Unable to change or propagate the value of a directory 
whose parent is changed via custom action

Everyone,

        I have the following directory structure in an MSI I am trying to build:


<Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="HELPDIR" Name="HELP">
                <!-- components here -->
                </Directory>
                <Directory Id="HELPDIR" Name="HELP">
                <!-- components here -->
                </Directory>

                <Directory Id="APPDATADIR" Name=".">
                        <Directory Id="PARMDIR" Name="PARM">
                        <!-- components here -->
                        </Directory>
                        <Directory Id="XMLDIR" Name="XML">
                        <!-- components here -->
                        </Directory>
                </Directory>
        </Directory>
</Fragment>


        Basically, I have a directory APPDATADIR whose parent is TARGETDIR; 
underneath are two directories whose parent is APPDATADIR.  I also have two 
child directories under TARGETDIR as well.  All of these directories have 
components or merge modules below them.  I am trying to use a custom action to 
change the value of APPDATADIR based on a second property called SPLITBUILD.  
This property can be changed via a dialog such that the child directories for 
APPDATADIR are modified accordingly via propagation.  I am doing this to give 
the user a choice about the components under APPDATADIR, i.e., whether or not 
to have the files/components under APPDATADIR installed under a different 
directory than the TARGETDIR.  The property SPLITBUILD is used in a radio 
button group with two choices with values of "Yes" as default and "No" (too 
lazy to write the code here but it does work).  Based on the value of 
SPLITBUILD, I am attempting to modify the APPDATADIR as follows:


<Fragment>
    <CustomAction Id="DIRCA_APPDATADIR_NOSPLITBUILD" Property="APPDATADIR" 
Value="[TARGETDIR]" Execute="immediate"/>
    <CustomAction Id="DIRCA_APPDATADIR_SPLITBUILD" Property="APPDATADIR" 
Value="[CommonAppDataFolder][FOLDERNAME]" Execute="immediate"/>

        <InstallUISequence>
        <Custom Action="DIRCA_APPDATADIR_NOSPLITBUILD" After="CostInitialize" 
Overridable="yes">SPLITBUILD &lt;&gt; "Yes"</Custom>
        <Custom Action="DIRCA_APPDATADIR_SPLITBUILD" 
After="DIRCA_APPDATADIR_NOSPLITBUILD" Overridable="yes">SPLITBUILD = 
"Yes"</Custom>
        </InstallUISequence>

        <InstallExecuteSequence>
        <Custom Action="DIRCA_APPDATADIR_NOSPLITBUILD" After="CostInitialize" 
Overridable="yes">SPLITBUILD &lt;&gt; "Yes"</Custom>
        <Custom Action="DIRCA_APPDATADIR_SPLITBUILD" 
After="DIRCA_APPDATADIR_NOSPLITBUILD" Overridable="yes">SPLITBUILD = 
"Yes"</Custom>
        </InstallExecuteSequence>
</Fragment>


        What happens is the following from looking at my installer logs: Before 
the user is given the SPLITBUILD option, APPDATADIR is set to 
"[CommonAppDataFolder][FOLDERNAME]", i.e., C:\ProgramData\FOLDERNAME\ , because 
SPLITBUILD is "Yes" by default .  The directories PARMDIR and XMLDIR are 
correctly set based on that value of APPDATADIR.  The user is then shown the 
radio button group to then modify SPLITBUILD.  The user modifies the value of 
SPLITBUILD to "No" and clicks Next and then eventually begins installing the 
product.  The value of APPDATADIR seems to be set to TARGETDIR from reading the 
logs.  However, the subdirectories under APPDATADIR are not recalculated based 
on that change, i.e., the change does not propagate.  I am trying to figure out 
how to configure the custom action above to properly pass the value of 
APPDATADIR such that PARMDIR and XMLDIR are modified based on the change.

        I have also tried setting APPDATADIR directly though the ControlEvent 
table instead of the custom actions above (clicking Next after changing 
SPLITBUILD would modify APPDATADIR).  However, the subdirectories were not 
modified based on the parent directory change.  I thought that moving the 
custom action to after the CostInitialize action would help.  Should I move it 
after FileCost but before CostFinalize?  I believe the standard event structure 
would normally be CostInitialize -> FileCost -> CostFinalize.  I moved the 
custom action into that block as the installer logs shows the MSI  doing 
recalculations of all the directories.  I have also tried changing the Execute= 
attribute for the custom action as well, but the results have been mixed.  I 
feel that I am so close yet so far.  Any feedback or assistance would be 
appreciated.  Thank you for your time.


David J. Antoine
Quality Assurance
ConvergEx Group | RealTick
danto...@realtick.com
This electronic mail message and any attached files contain information 
intended for the exclusive use of the individual or entity to whom it is 
addressed and may contain information that is proprietary, privileged, 
confidential and/or exempt from disclosure under applicable law. If you are not 
the intended recipient, you are hereby notified that any viewing, copying, 
disclosure or distribution of this information may be subject to legal 
restriction or sanction. Please notify the sender, by electronic mail or 
telephone, of any unintended recipients and delete the original message without 
making any copies.

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
This electronic mail message and any attached files contain information 
intended for the exclusive use of the individual or entity to whom it is 
addressed and may contain information that is proprietary, privileged, 
confidential and/or exempt from disclosure under applicable law. If you are not 
the intended recipient, you are hereby notified that any viewing, copying, 
disclosure or distribution of this information may be subject to legal 
restriction or sanction. Please notify the sender, by electronic mail or 
telephone, of any unintended recipients and delete the original message without 
making any copies.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to