user3555705
user3555705

Reputation: 31

Multiple entry in C# custom action dll in WIX

Can We have multiple dll entry as below example :

I have one Binary entry :

<Binary Id="SqlBrowse" SourceFile="..\SqlBrowse\bin\Debug\SqlBrowse.CA.dll"/>

Calling custom action

<CustomAction Id="SqlBrowseValidate" BinaryKey="SqlBrowse" 
              DllEntry="SqlValidate" Execute="immediate" Return="asyncWait">
</CustomAction>
<CustomAction Id="SqlBrowseID" BinaryKey="SqlBrowse" 
              DllEntry="CustomAction1" Execute="immediate">
</CustomAction>

I have two CA as :

 public static ActionResult CustomAction1(Session xiSession)
        {}
 public static ActionResult SqlValidate(Session sqlSession)
        {}

Upvotes: 3

Views: 1512

Answers (1)

Morten Frederiksen
Morten Frederiksen

Reputation: 5165

Yes, you can do that. Add logging information using session.Log:

First create your .NET custom actions:

public class CustomActions
{
  [CustomAction]
  public static ActionResult CustomAction1(Session session)
  {
    session.Log("Executing CustomAction1");
    return ActionResult.Success;
  }

  [CustomAction]
  public static ActionResult CustomAction2(Session session)
  {
    session.Log("Begin CustomAction2");
    return ActionResult.Success;
  }
}

Then schedule when to execute. I.e.:

<Binary Id="SqlBrowse" SourceFile="..\SqlBrowse\bin\Debug\SqlBrowse.CA.dll"/>
<CustomAction Id="CustomAction1" BinaryKey="SqlBrowse" 
              DllEntry="CustomAction1" Execute="immediate"></CustomAction>
<CustomAction Id="CustomAction2" BinaryKey="SqlBrowse" 
              DllEntry="CustomAction2" Execute="immediate"></CustomAction>

<InstallExecuteSequence>
  <Custom Action='CustomAction1' Before='InstallValidate'/>
  <Custom Action='CustomAction2' Before='InstallFinalize'/>
</InstallExecuteSequence>

Then create a logfile when installing:

msiexec /i "YourInstaller.msi" /l*v "log.txt"

Now you can verify that your CA's have been called.

Upvotes: 1

Related Questions