Custom Actions

  • Thread starter Thread starter Angela
  • Start date Start date
A

Angela

I wrote a class that I intended to be a custom action. I
added the DLL for the class to the setup project using the
CustomActions editor.
When I run the installer it completely ignores the custom
action I set up.

First I put everything in the class constructor in the
order I wanted it performed, I thought maybe the
constructor would be called by the installer. Well, that
didn't work so I created a Main method just to see if that
would help. In Main() I called the constructor. I ran
the installer and it still ignored my custom action.

How do I "hook up" the custom actions so that they will
actually be performed?
 
Angela,

I assume you are talking about .NET assembly when you say "DLL".
Then, you should inherit your class from the dedicated
System.Configuration.Install.Installer class and adorn it with the
[RunInstaller(true)] attribute. Then, add event handlers for events
like AfterInstall and BeforeUninstall to carry out your custom
routines.

After that, open the "Custom Actions" view of your deployment project
and add new custom actions for Install/Uninstall phases. Specify your
DLL as source file (be sure to include it to the list of installed
files), and ensure the InstallerClass property has been set to True.

That works like a charm for me and I hope this should also work OK
for you.
 
Back
Top