4

Is it possible to catch the uninstall event and execute some code when the program starts uninstalling?

program is installed by autoinstall. i already try to use this

public override void Uninstall(
 IDictionary savedState
)

but it said that method can not be overriden becouse it does not exist.

senzacionale
  • 20,448
  • 67
  • 204
  • 316

2 Answers2

3

If you are talking about Setup projects in Visual Studio then look at this thread: Install directory from deployment projects. You can execute code on the install and uninstall using the Installer class.

Community
  • 1
  • 1
YWE
  • 2,849
  • 28
  • 42
1

You should be able to do this using a System.Management listener for deletion of instances of Win32_Product. Take a look at this, you would need to use Win32_Product and __InstanceDeletionEvent though.

This applies to software installed using Windows Installer, at least. For others, you may have to brute force the registry settings or the like.

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140