3

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)
        {}
Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139

1 Answers1

1

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.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Morten Frederiksen
  • 5,114
  • 1
  • 40
  • 72
  • I tried and it didn't work for me. Have u ever tried and do you have some sample which you can share? – user3555705 Jul 07 '14 at 14:01
  • The OP should say what "it doesn't work" actually means and what the actual problem is. Can you have two CAs? Yes. But apparently there is some other issue that hasn't been described. You don't NEED session.log to see if a CA is called - just run the install with a verbose log and see if they are called or if there is failure when they are called. Maybe they are called or not, or maybe the code is failing. – PhilDW Jul 09 '14 at 17:01