views:

510

answers:

3

Hi everybody,

i got a problem regarding wix and managed custom actions: I already managed it to create an managed custom action and got it called from my installer (verified it in the installation log files). My Problem is now that i did't manage it to pass data to the custom action. Afaik if i choose to run the custom action in such a late stage i must mark the action as "deferred". With this limitation it's only possible to access the CustomActionData Property right? Why does this not work in my case? (As far as i can see i adoptet everything correctly from the samples?)

Here is what i already tried:

Custom Action:

   public class CustomActions
   { 
        [CustomAction]
        public static ActionResult RegisterDflHelp(Session session)
       {
        session.Log("Begin CustomAction1");

        session.Log("Before Access to customactiondata");
       //string helpdir = session["HELP_DIR"];
        string cad = session["CustomActionData"];
        Debugger.Break();
        session.Log("Help dir is: " + helpdir);
        session.Log("Custom Action Data is: " + cad);
        return ActionResult.Success;
       }

}

Merge Module which calls custom action:

<CustomAction Id='RegisterDflHelp' BinaryKey='RegisterDflHelpDll' DllEntry='RegisterDflHelp' Execute='deferred' />

<CustomAction Id="HELP_DIR.SetProperty" Return="check" Property="HELP_DIR" Value="Teeest" />

<Property Id='HELP_DIR' Secure='yes'/>

<InstallExecuteSequence>
  <Custom Action='HELP_DIR.SetProperty' After='InstallFiles' />
  <Custom Action='RegisterDflHelp' After='HELP_DIR.SetProperty' />
</InstallExecuteSequence>

<Directory Id="TARGETDIR" Name="SourceDir">
 </Directory>
<ComponentGroupRef Id="HelpGroup"/>

Product which includes Help-Merge Module:

<Product....>
<Package....>
...
<Directory>
<!--Directory which gets the help folder--!>
<Merge Id ="DflHelpInstaller" SourceFile="DflHelpInstaller.msm" Language="1033" DiskId="1" />

Anyone an idea? Thanks in advance!!

Daniel

Btw: What would also be interesting to know: At which stage in the installationprocess must an action marked as deferred? And if i managed it to call my custom action before this stage. Whats the advantage?

A: 

Hi,

somethimes using your head really helps;-)

the reason why the sample above does not work is quite simple:

Instead of:

CustomAction Id="HELP_DIR.SetProperty" Return="check" Property="HELP_DIR" Value="Teeest" />

I head to set the Property Attribute to the Action which should get the custom data!! here:

<CustomAction Id="HELP_DIR.SetProperty" Return="check" Property="RegisterDflHelp" Value="$(var.HelpSourceDir)" />

Hope that helps others to save the time i spend to solve this silly problem;-)

Daniel
A: 

You are still setting the HELP_DIR property instead of the custom action data. If you are trying to set the CustomActionData for the RegisterDfHelp action to "Teeest", then I think you should do this:

<CustomAction Id="SetRegisterDflHelpCustomActionData" Return="check" 
   Property="RegisterDflHelp" Value="Teeest" />

<InstallExecuteSequence>
   <Custom Action='SetRegisterDflHelpCustomActionData' After='InstallFiles' />
   <Custom Action='RegisterDflHelp' After='SetRegisterDflHelpCustomActionData' />
</InstallExecuteSequence>
Wim Coenen
A: 

Hi,

thanks for the tip! Luckily it's just a bug here - i do it the way you mentioned in my original code.

Thanks.

Daniel

related questions