Determine if Add-In has been invoked for uninstall

Add-in Express™ Support Service
That's what is more important than anything else

Determine if Add-In has been invoked for uninstall
 
Dave Gardner


Guest


Is there a way to determine that an AddIn is being invoked for the purposes of uninstall, versus a normal startup.

I am finding that during uninstall the AddinStartupComplete event handler is being called. I'd like to know if there is something I can programmatically query in my AddinStartupComplete event handler that will let me skip some code during uninstall.

Thanks,
Dave
Posted 02 Mar, 2007 05:49:12 Top
Thomas Guenther




Posts: 94
Joined: 2006-02-20
Hi!

Yes this is a question i'am interested too.

Dave, we have a similar problem here: we have code in our AddinStartupComplete event handler which should not been called during uninstall.

Btw. we are using VS 2003 and Addin Express V 3.3 .Net with the ADXLoader.

The following workaround did the trick for us but is a little bit ugly, so we need a better solution for the future:

We wrote a custom action as windows library for the setup package which inherits from the InstallerClass:
1.) Create a new Project in VS 200x as Windows library
2.) Add a new Class to your project derived from InstallerClass template
3.) Override the BeforeInstall method and place your code there
(We added a registry entry indicating that uninstall is in progress, yes i know it's not the best method but we had a less time to find a workaround)
4.) Place code in your AddinStartupComplete to check for what you did in point 3.)
5.) In your Setup project add a new custom action pointing to your Classlibray build as described above in your Uninstall action before the adxloader.dll entry and set InstallerClass to true.

That's it

Hope my explanations are clear enough. If you have questions don't hasitate to contact me.

Ciao,
Thomas
Posted 02 Mar, 2007 06:08:57 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Dave and Thomas.

A bit strange situation. The fact is that the AddinStartupComplete event is not called during the uninstallation process.
Please check if you have other add-ins registered in the host application at that time when you uninstall the add-in.
As to the uninstallation mode, you can use the BeforeUninstallControls and AfterUninstallControls events of the addinmodule to perform your code when the add-in is uninstalled.


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 02 Mar, 2007 08:46:28 Top
Thomas Guenther




Posts: 94
Joined: 2006-02-20
Hi Sergey!

On the system we tested our addin no other addins were installed. I tried to put some code into the BeforeUninstallControls handler too, but it was not called during uninstall. Maybe this happens, because we did not add any controls like a commandbars or a buttons to our addin.
We will check this.


Thanx,
Thomas
Posted 02 Mar, 2007 09:25:31 Top
Dave Gardner


Guest


Hi Sergey,

There is definately something that is causing the AddinStartupComplete event to be called during uninstall of our Add-In. However it is something specific to that Add-In, because I created a very simple add-in which did not subsequently call the AddinStartupComplete event during uninstall.

There are definately no other add-in's loaded - I performed all my tests on a clean virtual image. I will undertake some further testing/debugging and try to find out what is causing the AddinStartupComplete event to be called during uninstall on this one add-in. However we need to release our add-in to a customer, and as such we need an immediate solution.

Can you please answer the original question I asked? That is:

Is there a way to determine that an AddIn is being invoked for the purposes of uninstall, versus a normal startup.


The answer you gave regarding the use of BeforeUninstallControls and AfterUninstallControls does not solve the problem I have. I was hoping that there existed a simple test I could perform to determine whether the add-in was running normally versus running during uninstall. If there is not, I will have to implement something similar to the workaround that Thomas suggested (thanks Thomas).

Thanks,
Dave
Posted 02 Mar, 2007 09:40:04 Top
Thomas Guenther




Posts: 94
Joined: 2006-02-20
You'r welcome, Dave :)

Ciao,
Thomas
Posted 02 Mar, 2007 09:51:28 Top
Martin Mizzell


Guest


Hi,

I am now experiencing the same issue. My addin is being called during uninstall with no other addins installed.

Martin
Posted 02 Mar, 2007 09:53:28 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Martin.

Can you please send me the project that reproduces the issue?

Posted 02 Mar, 2007 10:09:10 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Dave, the add-in should not be running at all during the uninstalaion.
The Add-in Express library just creates an instance of the addinmodule when it is unregistered. Please set the DisplayAlerts property of the addinmodule to true to make sure that the host application is not running when the add-in is uninstalled.
I don't quite understand why the BeforeUninstallControls event doesn't fit your requirements.
Posted 02 Mar, 2007 10:15:13 Top
Martin Mizzell


Guest


There are too many dependencies to send the project. It would require you to install ALOT of stuff.
Posted 02 Mar, 2007 10:19:13 Top