How to re-add a deleted VSTO Add-In
Asked Answered
N

4

8

I've got a strange issue with a Word VSTO add-in on one machine where running the visual studio project opens word but does not attempt to start the add in as far as I can tell.

I got to this point because I accidentally clicked Remove for the Add-in on the Manage COM Add-ins page, instead of re-enabling it after a failure.

I want to know how to re-enable a deleted add-in - I'm thinking that perhaps there is a registry key somewhere I need to get rid of.

  • When I run the project from Visual Studio it does not attempt to start up at all, Word starts instantly with no "something-is-failing" type pause.
  • No breakpoints in ThisAddIn_Startup are hit.
  • In Word : File/Options/Add-ins - the add-in does not appear under Inactive or Disabled Addins
  • Word : Manage COM Add-ins Go... it does not appear.
  • Word : Manage Disabled Items Go... is empty.

I've tried installing and uninstalling the published version, to see if that wakes anything up, and I've tried changing the path of the VS project, just in case that makes a difference (and various restarts, cleans, rebuilds, locally deleting and re-cloning from git etc) but I can't find a way to get this to work again. On a different machine, cloning the add-in from Git and opening it in Visual Studio and its all fine.

I've tried re-adding via the select DLL (or select .) dialog on the COM Add-ins but nothing I select appears to be a valid add-in.

Any help to figure out how to get back to a working development environment would be appreciated.

EDIT There's a lot going on below - so I thought I'd clarify that the successful solution was the online-repair of Office

Northman answered 20/5, 2019 at 15:37 Comment(4)
Did you try to increase Publish Version ( in Visual Studio, the project property page, tab Publish)?Wrath
What happens if you run Build/Clean Solution and then Build/Rebuild solution? That has often helped "kick things loose* for me...Panto
Cleaning and rebuilding I'd already tried (along with delete all and re-clone). Publish version change also didn't help. I also tried changing the projectguid in the csproj file, which again didn't help...odd)Northman
Online repair did not work for me. So far the only fix which worked for me was to change the Assembly name. Obviously, that is not viable once at production... This button should never have existed (fact: it is not available for Excel COM add-ins!). For anyone with the same problem, I provide further things to try here: #57099310Blancheblanchette
W
3

What is the LoadBehaviour in the registry? It should be 3...

To find out, look in

  • 32bit Word => Root\Software\Microsoft\Office\Word\Addins\add-in ID
  • 64bit Word => Root\Software\Wow6432Node\Microsoft\Office\Word\Addins\add-in ID

where Root is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether the addin is installed for current user or everyone.

If the value for LoadBehaviour is not 3, then change it to 3 and restart Word.

Here is the Microsoft docs about it: Registry entries for VSTO Add-ins

If it still does not work, try to re-enable as it might be hard disabled:

  • In the Manage box, change COM Add-ins to Disabled Add-ins, and click Go.
  • Select the add-in and click Enable. Click Close. Now the add-in can be loaded again...
  • Back in the Manage box, change Disabled Add-ins to COM Add-ins, and then click Go.
  • Check the checkbox next to the disabled add-in. Click OK.

Here is the Microsoft docs about it: How to: Re-enable a VSTO Add-in that has been disabled

Also, if you haven't done this already, it is worth setting VSTO_SUPPRESSDISPLAYALERTS to 0 as described on this page: How do I enable VSTO error / display alerts?

If none of the above helps, then it is worth doing a Online repair of Office from Add or Remove Programs.

Wallop answered 5/6, 2019 at 10:17 Comment(8)
Loadbehaviour is 3. Always has been. Which is the oddest part of it!Northman
It does not appear in Disabled Add-ins or the Manage Com Add-ins screens (as per issue description) so those steps can't be applied. I'll try the display-alerts now.Northman
Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins\HB_Toolbar Does not exist in the other 3 potential locationsNorthman
@Northman - if nothing else helps - do an Office Repair from Add/Remove Programs... Choose the full/online one.Wallop
No alerts are displayed with the VSTO_SUPPRESSDISPLAYALERTS setting to 0. This makes sense as I don't think anything is actually even trying to start / install it.Northman
@Northman - BTW: are you running VS as Administrator?Wallop
Yes, I am running VS as admin - my shortcut is set that way. I tried it as not-admin and that didn't help.Northman
ONLINE REPAIR WINS - at last, running again!Northman
E
3

I believe that you need to change the version of the VSTO add-in in order to be able to update it or re-install it. Once an add-in version has been disabled, this is permanent.

See Uninstall MS Word Add-in for details. Let me know if that worked.

Emeraldemerge answered 3/6, 2019 at 13:13 Comment(4)
Following the steps in the linked article, it successfully installs the add in, and it runs in Word when executed from the desktop. However, it doesn't show the add-in, or hit any startup breakpoints when run from VS (2017 or 2019)Northman
Do you see like disabled breakpoints in Visual Studio? It could be that Visual Studio is not seeing the right code when you run in Debug. Try manually deleting the bin and obj folders, and rebuild. This sometimes fixes that kind of problem.Emeraldemerge
They are not disabled. Even when running they are the solid red breakpoints. Deleting bin and obj dont help : I've just re-tested that, but I had previously deleted the project and re-cloned from git which would have done the same thingNorthman
Not sure what the problem is. Try #39565793 or #7021124 or #3551913Emeraldemerge
W
3

What is the LoadBehaviour in the registry? It should be 3...

To find out, look in

  • 32bit Word => Root\Software\Microsoft\Office\Word\Addins\add-in ID
  • 64bit Word => Root\Software\Wow6432Node\Microsoft\Office\Word\Addins\add-in ID

where Root is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether the addin is installed for current user or everyone.

If the value for LoadBehaviour is not 3, then change it to 3 and restart Word.

Here is the Microsoft docs about it: Registry entries for VSTO Add-ins

If it still does not work, try to re-enable as it might be hard disabled:

  • In the Manage box, change COM Add-ins to Disabled Add-ins, and click Go.
  • Select the add-in and click Enable. Click Close. Now the add-in can be loaded again...
  • Back in the Manage box, change Disabled Add-ins to COM Add-ins, and then click Go.
  • Check the checkbox next to the disabled add-in. Click OK.

Here is the Microsoft docs about it: How to: Re-enable a VSTO Add-in that has been disabled

Also, if you haven't done this already, it is worth setting VSTO_SUPPRESSDISPLAYALERTS to 0 as described on this page: How do I enable VSTO error / display alerts?

If none of the above helps, then it is worth doing a Online repair of Office from Add or Remove Programs.

Wallop answered 5/6, 2019 at 10:17 Comment(8)
Loadbehaviour is 3. Always has been. Which is the oddest part of it!Northman
It does not appear in Disabled Add-ins or the Manage Com Add-ins screens (as per issue description) so those steps can't be applied. I'll try the display-alerts now.Northman
Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins\HB_Toolbar Does not exist in the other 3 potential locationsNorthman
@Northman - if nothing else helps - do an Office Repair from Add/Remove Programs... Choose the full/online one.Wallop
No alerts are displayed with the VSTO_SUPPRESSDISPLAYALERTS setting to 0. This makes sense as I don't think anything is actually even trying to start / install it.Northman
@Northman - BTW: are you running VS as Administrator?Wallop
Yes, I am running VS as admin - my shortcut is set that way. I tried it as not-admin and that didn't help.Northman
ONLINE REPAIR WINS - at last, running again!Northman
A
1

The most extreme steps I've had to take when things aren't working as expected are to clear out the VSTA cache, either in the registry or the filesystem. Note that I work with template-based customizations that are attached to documents, not add-ins that are always present, so this may not apply to you. Or maybe it does, I don't know.

Registry

Look for an entry for your add-in under HKCU:\Software\Microsoft\VSTA\Solutions. I use PowerShell for this, and an example command chain would be something like this:

gci "HKCU:\Software\Microsoft\VSTA\Solutions"


    Hive: HKEY_CURRENT_USER\Software\Microsoft\VSTA\Solutions


Name                           Property                                                                                                                                                                                     
----                           --------                                                                                                                                                                                     
1234abcd-1234-abcd-1234-abcd12 Url                 : file:///Z:/path/to/your/addin.vsto                                                              
34abcd                         SubscriptionID      : addin.vsto, Culture=neutral, PublicKeyToken=<removed>, processorArchitecture=msil                                                                        
                               ApplicationID       : file:///Z:/path/to/your/addin.vsto#addin.vsto, Version=<removed>, Culture=neutral, 
                                                     PublicKeyToken=<removed>, processorArchitecture=msil/addin.dll, Version=<removed>, Culture=neutral, PublicKeyToken=<removed>,                     
                               processorArchitecture=msil, type=win32                                                                                                                                                       
                               ProductName         : addin                                                                                                                                                           
                               LastCheckedTime     : {4, 201, 185, 1...}                                                                                                                                                    
                               UpdateEnabled       : 1                                                                                                                                                                      
                               UpdateInterval      : 1                                                                                                                                                                      
                               UpdateIntervalUnits : days            

remove-item "HKCU:\Software\Microsoft\VSTA\Solutions\1234abcd-1234-abcd-1234-abcd1234abcd"

Filesystem

My customizations (see note at the start) are installed at %localappdata%\Apps\2.0 and on rare occasions I need to delete them manually. Clearing this one out is less straightforward, but usually there's a single anonymized folder like ABCDEFG0.QWE. I just delete that, and along with the other half of this, I've never run into a problem I couldn't solve. FYI if you have multiple deployments this might uninstall all of them. I don't do it very often so I'm not 100% familiar with how this area works, but I've never made anything worse by doing this.

I don't know how this differs, if at all, for application-level add-ins, that can be installed to Program Files.

Edit: adding some relevant links.

How do I completely uninstall a ClickOnce application from my computer?

Clear the .NET-downloaded application cache without Mage?

Abbevillian answered 31/5, 2019 at 13:45 Comment(3)
There is nothing under HKCU:\Software\Microsoft\VSTA\ - I guess COM addins don't live there. I tried clearing everything I can find elsewhere in the registry but no success in getting it to run from VSNorthman
@Northman Does your add-in get installed for all users, and/or from the Program Files folder? If so try HKLM instead. You might have to do some registry searching, the folder might not be the exact same. I.e. WOW6432Node might throw things off.Abbevillian
Lots of registry searching done, by add in name, path, etc. Note on lack of progress above.Northman
W
0

I faced the same problem. At first I deleted the corresponding registry key for the addin (The registry path can be found in the other answers). After that I tried Build > Clean Solution and after that Rebuild Solution. That solved the issue.

Woundwort answered 28/7, 2022 at 21:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.