It is essential that managed custom actions have an [CustomAction] attribute 
for each method call that will be used as a custom action.  E.g.,

[CustomAction]
Public static ActionResult DoSomething(Session session)
{
  // code here
}

By having the Return attribute set to "ignore", the errors that you would 
normally get are hidden from you unless you look very closely at a verbose log.

--
John Merryweather Cooper
Senior Software Engineer | Enterprise Service Applications | Continuing 
Development
Jack Henry & Associates, Inc.® | Lenexa, KS  66214 | Ext:  431050 
|jocoo...@jackhenry.com



-----Original Message-----
From: Craig Reeves [mailto:craig.ree...@kraygsoft.com] 
Sent: Friday, January 30, 2015 2:40 AM
To: General discussion about the WiX toolset.
Subject: [WiX-users] Custom Action not be called

I have some problems with managed code custom actions. I have 3 custom actions 
but only one of them is working. They are called at different times in 
InstallExecuteSequence but moving them makes no difference. I know there not 
getting very far because if I place a message box at the beginning of the 
routine(for debugging) it never get called . Where am I going wrong ? The 
actions are created like so.


<Binary Id="CA" 
SourceFile="$(var.ca.Custom.Actions.TargetDir)$(var.ca.Custom.Actions.TargetName).CA.dll"
 />
         <CustomAction Id="WriteRemoveArpEntry" Property="CustomActionData" 
Value="PNAME=$(var.ProductName)" HideTarget="yes" />
    <CustomAction Id="RemoveArpEntry" BinaryKey="CA" 
DllEntry="RemoveProductFromARP" Return="ignore" />

    <CustomAction Id="SetValueforProductFolder" Property="CustomActionData" 
Value="SDIR=[INSTALLDIR];TDIR=[MANUDIR]\backup\$(var.ProductName)\$(var.VersionNumber)"
 HideTarget="yes" />
    <CustomAction Id="Backup_Product_DIR" BinaryKey="CA" DllEntry="BackupDIR" 
Return="ignore" />

   <CustomAction Id="WriteInstallAttemptData" Property="CustomActionData" 
Value="PRODUCTNAME=$(var.ProductName);APPVERSION=$(var.VersionNumber)" 
HideTarget="yes" />
    <CustomAction Id="WriteInstallAttempt" BinaryKey="CA" 
DllEntry="WriteXMLServer" Return="ignore" />


I then call them here


<Custom Action="SetValueforProductFolder" Before="Backup_Product_DIR">NOT 
Installed AND NOT REMOVE</Custom>
  <Custom Action="Backup_Product_DIR" Before="InstallFinalize">NOT Installed 
AND NOT REMOVE</Custom>
  <Custom Action="WriteRemoveArpEntry" Before="InstallFinalize">NOT Installed 
AND NOT REMOVE</Custom>
  <Custom Action="RemoveArpEntry" After="WriteRemoveArpEntry">NOT Installed AND 
NOT REMOVE</Custom>
  <Custom Action="WriteInstallAttemptData" After="InstallFinalize">NOT 
Installed AND NOT REMOVE</Custom>
  <Custom Action="WriteInstallAttempt" After="WriteInstallAttemptData">NOT 
Installed AND NOT REMOVE</Custom>

 </InstallExecuteSequence>


The headers for the routines look like this

public static ActionResult BackupDIR(Session session)
   {


public static ActionResult RemoveProductFromARP(Session session)
   {

Public static ActionResult WriteXMLServer(Session session)
    {

However only WriteXMLServer works. In the log file I get the following .

MSI (s) (BC:9C) [07:23:45:562]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSI2E2A.tmp, Entrypoint: BackupDIR CustomAction 
Backup_Product_DIR returned actual error code 1154 but will be translated to 
success due to continue marking

In the one that works I get

MSI (s) (BC:A0) [07:24:25:994]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSICC20.tmp, Entrypoint: WriteXMLServer SFXCA: Extracting 
custom action to temporary directory: C:\Windows\Installer\MSICC20.tmp-\ SFXCA: 
Binding to CLR version v4.0.30319?

Done this sort of thing lots of time's and never had any problems.

------------------------------------------------------------------------------
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

Reply via email to