cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sysadmin-blr
Level 5

OnBeforeUninstall event not firing in Basic msi project

Hi Team, i am creating a setup project in Basic msi. I am having a class which inherits from Installer to get some data from user while install/uninstall. But the following event is not firing before uninstall. Is there any settings i need to update. protected override void OnBeforeUninstall(IDictionary savedState) Thanks, Ramesh P.
0 Kudos
(4) Replies
UtsabKarmakar
Level 5 Flexeran
Level 5 Flexeran

Hi,

I guess you are talking about Service Installer Project for .NET application where System.Configuration.Install is the inherited class and you are trying to call "protected virtual void OnBeforeUninstall (System.Collections.IDictionary savedState);".


If so, may I know how are you calling the event from Basic MSI ? If not wrong Managed Custom Action ?

Thanks

0 Kudos

we have just set the property ".NET Installer Class " to "Yes" under .NET Settings.
0 Kudos

Hi @sysadmin-blr,

 

From the issue description i could get that you are adding .Net assembly which is derived from System.Configuration.Install.Installer and setting property to "Yes".

As mentioned here:

https://docs.microsoft.com/en-us/dotnet/api/system.configuration.install.installer.onbeforeuninstall?view=netframework-4.8

Notes to Inheritors

When overriding OnBeforeUninstall(IDictionary) in a derived class, be sure to call the base class's OnBeforeUninstall(IDictionary)method so that registered delegates receive the event.

Is that added in the .Net assembly you had added here?

 

Thanks,

Jenifer

0 Kudos

Hi @sysadmin-blr,

I have tried the same and it seems to work as expected.

As suggested by @Jenifer did you try calling the base class when overriding the OnBeforeUninstall(IDictionary savedState) function.

protected override void OnBeforeUninstall(IDictionary savedState)
        {
            base.OnBeforeUninstall(savedState);

            // Your code goes here //

        }

Thanks,

0 Kudos