Creating a (ClickOnce) setup for VSTO Outlook Add-in

add-inclickoncems-officeregistryvsto

So I created an Outlook Add-in and used the click-once setup to deploy it.

The setup runs fine when the user is administrator, but otherwise: no go.

Running the setup with "run as…" and logging in as admin works, but than the add-in is installed under the admin, not the current user. The addin doesn't show up in outlook.

I tried following this guide:
http://blogs.msdn.com/mshneer/archive/2008/04/24/deploying-your-vsto-add-in-to-all-users-part-iii.aspx

But I get stuck at part I:
http://blogs.msdn.com/mshneer/archive/2007/09/04/deploying-your-vsto-add-in-to-all-users-part-i.aspx

I follow the examples and start excel as described:

Now start Excel application. Examine
the registry keys in HKCU hive e.g.
you will find two interesting
registry keys that appear under your
HKCU hive:

  • HKCU\Software\Microsoft\Office\TestKey
    registry key containing registry value
    TestValue
  • You now also have
    HKCU\Software\Microsoft\Office\12.0\User
    Settings\TestPropagation registry key
    with Count value set to 1

But on my machine, the keys are not created… What can I try next?

Best Answer

I haven't done this in a few years, but from memory office addins get "registered" like this:

  1. put files in the right place
  2. register .NET COM object which represents your addin
  3. put registry entries under Microsoft\Office\Addins to tell office to load your COM object.

If my thinking is correct, the problem will be that you need to register the COM object. Registering COM objects is a per-machine action and hence requires admin privileges.

You'll be able to see if this is indeed what's happening. Your registry key under the office addins one will be called something like MyAddin.Connect. You can then search under HKEY_CLASSES_ROOT for MyAddin.Connect and it should be present when you run the install as admin, and not present when running as per-user.

If it is this, you can get around it by doing a per-user registration of the COM object, but this is a bit painful.

Things may be easier these days, but when I had to do it, you used a utility called RegCap.exe to capture the registry entries associated with the COM object into a .reg file, then modify the .reg file with a text editor to replace HKLM with HKCU, then instead of registering the COM object, you load this .reg file.

Related Topic