Thanks Cosmin.
Following your tips, I have changed things. However, my custom action still is not being triggered. Can you please advise on what I am doing wrong.
Here is what I have changed:
1) I now use the default setting of "LaunchDotNetCustomAction" for the FunctionName field in the custom action properties.
2) I have implemented my C# custom action so that it overrides the Install event.
3) In my DLL, I now have a static method named "LaunchDotNetCustomAction" which takes no parmeters and returns a value of zero.
Following is my C# code. Note that I have put code in both the overriden event handler and in the LaunchDotNetCustomAction which simply writes to a file:
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.IO;
namespace AdvancedInstallerUtility
{
[RunInstaller(true)]
public partial class AdvancedInstallerCustomActions : Installer
{
public AdvancedInstallerCustomActions()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
StreamWriter sw;
sw = new StreamWriter("C:\\AI_Log.txt", true);
sw.WriteLine("In event handler");
sw.Flush();
sw.Close();
}
public int LaunchDotNetCustomAction()
{
StreamWriter sw;
sw = new StreamWriter("C:\\AI_Log.txt", true);
sw.WriteLine("In custom action");
sw.Flush();
sw.Close();
return 0;
}
}
}
Thanks,
cats