Add-In registration while Excel is running

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

Add-In registration while Excel is running
 
Sergei Bubenko


Guest


Hello,

Is it possible to re-register Excel Add-in while Excel is running?
We need this in order to have automatic updates. Sometimes it works perfect, but in rare cases after registration and when you open new Excel instance, we see that COM add-in is absent.

Our configuration is below:
1. Excel Add-in with XLL and COM in one assembly.
2. Per-user deployment.
3. Custom automatic update (checks that updates are available at startup and replace add-in assembly).
4. 'Shadow copy' is enabled in Loader's manifest.
5. Office 2003 and Office 2007.

In particular, following steps lead to issue described above:
1. Uninstall add-in.
2. Run Excel ?Â?Ð?ã our add-in was not loaded.
3. Run ADXRegistrator.exe manually with valid parameters.
4. Run new Excel instance ?Â?Ð?ã add-in was loaded correctly.
5. Run ADXRegistrator.exe again (with valid parameters).
6. Run new Excel instance ?Â?Ð?ã toolbar with add-in was not added to Excel.

Log files that ADXLoader and ADXRegistrator generate doesn't contain any errors.
Note that sometimes steps above don't produce issue.

Please advice.

Thanks.
Posted 10 Nov, 2011 07:38:48 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Hi Sergei,

It is not possible to unregister AND UNLOAD an add-in while the host application is running.

Sergei Bubenko writes:
We need this in order to have automatic updates.


Both ClickOnce and ClickTwice (web-based MSI updates) require that you re-start the host application.

Sergei Bubenko writes:
In particular, following steps lead to issue described above:


Are you saying that you run several Excel instances without closing the instance(s) you run previously?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2011 08:54:01 Top
Sergei Bubenko


Guest


Hi Andrei,

Thank you for quick reply.

The idea is to get updated Add-In after new Excel instance is started (outdated add-in version will run until existing Excel instance will be closed). So, add-in doing self-update for the next Excel instance opened. And we don't close existing Excel instance.

Thanks.
Posted 10 Nov, 2011 09:37:13 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Sergei,

Do you register or unregister the add-in in step 5?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2011 09:55:42 Top
Sergei Bubenko


Guest


We do register there (use /install switch with adxregistrator.exe).

Thanks.
Posted 10 Nov, 2011 10:08:35 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Are you saying that you register the add-in, then run a new Excel instance and run the add-in once again? If so, may I ask you: why do you do so? I'm confused a bit...


Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2011 10:26:39 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
A correction: Are you saying that you register the add-in, then run a new Excel instance and run the add-in registration once again?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2011 11:32:50 Top
Sergei Bubenko


Guest


Hi Andrei,

Steps above is just to illustrate issue. In real life we are supposed to update add-in assembly while Excel is running and register it. So user will work with the latest version next time he will start Excel. Probably, we can just replace add-in assembly with the latest version and do not call to adxregistrator. Will it work this way?

Thanks.
Posted 10 Nov, 2011 15:12:55 Top
Andrei Smolin


Add-in Express team


Posts: 18819
Joined: 2006-05-11
Hi Sergei,

When it is loaded, an Add-in Express based add-in consists of two parts: the add-in assembly and the loader. From the viewpoint of the host application, the loader is the add-in itself: all registry entries point to the loader. So, when the host application starts, it loads the loader (adxloader.dll). The loader reads the manifest and loads the add-in assembly into an AppDomain.

Then you use adxregistrator to unregister the add-in while the host is running. This removes the registry entries but the loader and the add-in assembly are still loaded. And the loader DLL is locked by Excel; you will not able to replace it. This causes problems in case you need to replace the loader DLL.

Plus, I have an impression that you cannot run another instance of the host application in Office 2010.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Nov, 2011 08:55:59 Top
Sergei Bubenko


Guest


Hi Andrei,

Our environment is only Office 2003 and Office 2007.

We understand the basics on how Add-In Express based add-in is loading. And we don't unregister add-in while Excel is running. I thing that it is impossible since adxregistrator shows popup which is require us to close Excel. We only try to re-register add-in while Excel is running. We do it just after add-in dll have been updated. And the only goal we want to achieve is to get add-in self-updated effectively without closing.

Let me summarize my questions:

1. Why COM add-in is failed to load when we perform steps that I've described in my first post.

2. If #1 is expected, so why adxregistrator.exe completed successfully (without any errors and even without any error in log file)?

3. Probably, I am guessing, COM add-in failed to load in steps above due to the fact that we update add-in dll to the new binary but with the same assembly name. So 'shadow copy' failed. Will it work if we do update add-in assembly to the new one with different full assembly name?

I know all above is a tricky, but we strongly need self-update feature for our Add-in Express based add-in.
Would you please help us with these questions?

Thanks.
Posted 14 Nov, 2011 15:29:11 Top