Hi,
I think DTF custom actions always need a Session object as parameter.With the 
session object you can get installer properties. 
Here is a example of a working C# CustomAction.
[CustomAction]public static ActionResult ConnectDb(Session session){    string 
test = session["property"];}
<Binary Id="Custom.dll" 
SourceFile="$(var.Custom.TargetDir)\$(var.Custom.TargetName).CA.dll" 
/><CustomAction Id="ConnectDbAction" BinaryKey="Custom.dll" 
DllEntry="ConnectDb" Execute="immediate" Return="check" />
Regards,
Dick van den Brink

> From: [email protected]
> To: [email protected]
> Date: Wed, 20 Apr 2011 14:09:05 +0000
> Subject: [WiX-users] C# CustomAction DLL won't run?
> 
> Hi Guys,
> 
> I've been writing a custom-action for detecting if a given feature is 
> installed on the machine. If I use it as an executable, it is fine:
> 
> <Binary Id="CheckWindowsFeatureInstalledCustomAction" 
> SourceFile="..\CheckWindowsFeatureInstalledCustomAction\bin\$(var.Build)\CheckWindowsFeatureInstalledCustomAction.exe"
>  />
>     <Property 
> Id="CheckWindowsFeaturesArgs"><![CDATA["WCF-NonHTTP-Activation"]]></Property>
>     <CustomAction Id="CheckNonHttpActivationEnabled"
>                   BinaryKey="CheckWindowsFeatureInstalledCustomAction"
>                   Execute="immediate"
>                   Return="check"
>                   ExeCommand="[CheckWindowsFeaturesArgs]"/>
> 
> But if I set it up as a DLL it fails to run/load:
> 
>     <Binary Id="CheckWindowsFeatureInstalledCustomAction" 
> SourceFile="..\CheckWindowsFeatureInstalledCustomAction\bin\$(var.Build)\CheckWindowsFeatureInstalledCustomAction.dll"
>  />
>     <Property 
> Id="CheckNonHttpActivationEnabled"><![CDATA["WCF-NonHTTP-Activation"]]></Property>
>     <CustomAction Id="CheckNonHttpActivationEnabled"
>                   BinaryKey="CheckWindowsFeatureInstalledCustomAction"
>                   Execute="immediate"
>                   Return="check"
>                   DllEntry="Check"/>
> 
> I've added the CustomAction attribute to my method, but I get the default DLL 
> error message from the installer when I run it.
> 
> I've switched back to using as an executable, but left the CustomAction 
> attribute on, along with the reference to 
> Microsoft.Deployment.WindowsInstaller and I get a FileNotFoundException 
> thrown that says it could not find the Micorsoft.Deployment.dll file.
> 
> Has anyone got an example of a working c# DLL Custom Action, preferably that 
> accepts a parameter?
> 
> Many thanks,
> J.
> ________________________________
> 
> This email is from Pinesoft Limited. Its contents are confidential to the 
> intended recipient(s) at the email address(es) to which it has been 
> addressed. It may not be disclosed to or used by anyone other than the 
> addressee(s), nor may it be copied in anyway. If received in error, please 
> contact the sender, then delete it from your system. Although this email and 
> attachments are believed to be free of virus, or any other defect which might 
> affect any computer or IT system into which they are received and opened, it 
> is the responsibility of the recipient to ensure that they are virus free and 
> no responsibility is accepted by Pinesoft for any loss or damage arising in 
> any way from receipt or use thereof.
> 
> Pinesoft Limited are registered in England, Registered number: 2914825. 
> Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
> ? Consider your responsibility to the environment - think before you print!
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload 
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve 
> application availability and disaster protection. Learn more about boosting 
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
                                          
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to