Custom Actions

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

Dmitriy Lapshin [C# / .NET MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top