How to deploy and debug Office 2007 - 2000
add-in / plug-in in VB.NET, C#, C++ - tips

Add-in Express™
for Microsoft® Office and .net

Add-in Express Home > Add-in Express .NET > Online Guide > Deploying and debugging tips

Deploying and debugging tips

Writing COM add-ins in Visual Studio .NET - Flash video

Deploying Office extensions
How do I find the PublicKeyToken of my add-in?
Deploying Office add-ins
How to deploy your Office add-in for all users?
Deploying add-ins – shadow copy
Deploying – "Everyone" option in a COM Add-in MSI package
How to find the PublicKeyToken of my add-in?
My add-in is always disconnected
ClickOnce cache
ClickOnce deployment
Customizing dialogs when updating the add-in via ClickOnce
User Account Control (UAC) on Vista
Deploying Word add-ins
Custom actions when your COM add-in is uninstalled

Deploying Office extensions

COM add-ins and RTD servers can be installed either for the current user or for all users on the PC. Smart Tags, Excel Automation add-ins and XLL add-ins can be installed for the current user only.

How do I find the PublicKeyToken of my add-in?

You can find it in the setup project, which must be already built. Click on your add-in primary output in the setup project and, in the Properties window, expand the KeyOutput property and see the PublicKeyToken property value.

Deploying Office add-ins

  • Make sure your Vista, Windows XP, and Office have all updates installed: Microsoft eventually closes their slips and blunders with service packs and other updates. Keep an eye on Visual Studio 2005 updates, too.
  • If a non-admin user will install your add-in, use [AppDataFolder] as the default location. Make sure the user is instructed to run MSI. On Vista, if the user runs setup.exe, a non-admin will get the elevation dialog and this can end with installing the add-in to the admin profile. In such a case, the add-in will not be available for the standard user.

How to deploy your Office add-in for all users?

If your add-in is based on the Add-in Express loader, you can easily do deployment for all users. Just set the RegisterForAllUsers property of the add-in module to true. This will also change the manifest (adxloader.dll.manifest) so that the add-in will register to HKEY_LOCAL_MACHINE rather than to HKEY_CURRENT_USER. If you create a shared add-in, you need to choose an appropriate checkbox in the wizard.

And if your add-in is based on the VSTO loader, all users deployment is not possible.

Deploying add-ins – shadow copy

The Add-in Express Loader uses the ShadowCopy-related properties and methods of the AppDomain class. When you run your Add-in Express based add-in, the host application loads the Add-in Express Loader DLL referenced in the registry. The Add-in Express Loader DLL does the following:

  • It finds your add-in DLLs in the DLL Cache. If there are no add-in DLLs in the cache it copies all .NET DLLs to the cache (including dependencies). The cache folder is located in c:\Documents and Settings\<user name>\Local Settings\Application Data\assembly\dl<number>. If all add-in DLLs (including dependencies) already exist in the cache, it compares their versions. If the versions are not the same, it copies new DLLs to the cache.
  • It loads the add-in DLLs from the cache.

You can see how the add-in versioning influences the add-in loading. This approach (it is built into .NET, as you see) allows you to replace add-in DLLs when the add-in is loaded. The disadvantage is numerous files located in the cache. As far as we know, Microsoft doesn't provide a solution for this problem. You may think you can remove these files in an add-in’s uninstall custom action. But you remove the files from the current profile only.

Deploying – "Everyone" option in a COM Add-in MSI package

The Everyone option of the msi installer doesn't have any effect on the Add-in Express based COM add-ins and RTD servers.

How to find the PublicKeyToken of my add-in?

It can be found in the setup project (that must be already built) - click on your add-in primary output in the setup project and, in the Properties window, expand the KeyOutput property and see the PublicKeyToken property value.

My add-in is always disconnected

If your COM add-in fires exceptions at the startup, the host application can block the add-in and move it to the Disabled Items list. To find the list, in the host application, go to "Help", then "About". At the bottom of the About dialog, there is the Disabled Items button. Check it to see if the add-in is listed there (if so, select it and click the enable button).

ClickOnce cache

The cache location is visible in the COM Add-ins dialog. It may have the following look:

C:\Documents and Settings\user\Local
Settings\Apps\2.0\NCPNO3QK.0KJ\ONNRMXC3.ALM\add-..d-
in_5c073faf40955414_0001.0000_2a2d23ab74b720da

Currently, we don't know if there is a decent way to clear the cache. Read more about deploying Office add-ins with Add-in Express ClickOnce solution.

ClickOnce deployment

Make sure that your IIS is allowed to process .application files. For instance, on one of our PCs, we had to edit the urlscan.ini file created by UrlScan. The only change was adding the .application extension to the AllowExtensions list. The full file name is C:\WINDOWS\system32\inetsrv\urlscan\urlscan.ini.

Customizing dialogs when updating the add-in via ClickOnce

ClickOnce doesn't provide any opportunity to customize or hide dialogs and messages shown while the user updates your add-in.

User Account Control (UAC) on Vista

The User Account Control (UAC) should be turned on Vista. This is a must when you install a COM add-in for all users on the PC, that is, when the RegisterForAllUsers property of the add-in module is true.

Deploying Word add-ins

If your add-in delivers custom or customizes built-in command bars in any Word version, it isn't recommended to set the RegisterForAllUsers property of the add-in module to True. Since Word saves UI changes to normal.dot, every user has its own copy of command bars saved to their normal.dot. And when the user uninstalls the add-in, the command bars will be removed for that user only.

Custom actions when your COM add-in is uninstalled

When the add-in is being unregistered, the BeforeUninstallControls and AfterUninstallControls events occur. You can use them for, say, removing “hanging” command bars from Word or restoring any other state that should be restored when your add-in is uninstalled.

Note. If you didn't find the answer to your questions on this page, please see the HOWTOs section:

Excel UDF and RTD tips <<

Back to Add-in Express .NET homepage

Have any questions? Ask us right now!