none
C# Word Re-enable an add-in RRS feed

  • Question

  • Hi,

    Please, Help! My new add-in Ribbon tab doesn´t show again.

    Steps to reproduce
    1. Start with a new Word add-in template in Visual Studio 2010. 
    2. Add a button to the new Robbon. The button adds some text to the Word Document. 
    3. Execute the project (F5). Word shows my new Ribbon and button. 
    4. Then (without closing Word) Click on Visual Studio and stop debuggin (SHIFT + F5).
    5. In Visual Studio run the project again.
    6. A dialog box will appear asking to (Yes/No) disable the new Add-In. Click "yes" (allow disable).
    7. After step 6 it is impossible for me to get the new Add-in back in Word. 

    How to re-enable an add-in that has been disabled by Word 2010
    - In the application, click the Microsoft Office Button.
    - Click the <ApplicationName> Options button.
    - In the categories pane, click Add-ins.
    - In the details pane, locate the add-in in the Disabled Application Add-ins list.
    - The Name column specifies the name of the assembly, 
      and the Location column specifies the full path of the application manifest.
    - In the Manage box, click Disabled Add-ins, and then click Go.
    - Select the add-in and click Enable.
    - Click Close.
    * Nothing is changed after the dialog box is closed...

    What do I need to do next, instead of recreating my project?

    Wednesday, May 8, 2013 1:15 PM

Answers

  • Hi Berend

    A colleague of mine was once fond of quoting "If it hurts, stop doing it". That's my reaction to reading your steps to reproduce. When you choose to stop debugging you're basically "crashing" your add-in, as far as Word is concerned. This will make Word black-list it, especially after you confirm to Word that it should disable the add-in.

    One thing I haven't seen suggested yet in this thread is that you run "Clean Build" from within your VSTO project. That should clean up the Registry entries the debug process creates.

    It's also a bad idea to perform an installation on your developer machine where you want to debug. Run an uninstall in Windows.

    If your manual "tweaking" in the Registry has resulted in Clean Build and uninstall not being able to remove Registry entries, remove them by hand.

    In the Word UI, where you're seeing the Add-in listed but unchecked use the Remove command to remove it from the list (assuming Clean Build and uninstall haven't already done so).

    Now try running in Debug mode again and DO NOT give the command to stop debugging. Close the Word application so that the add-in unloads correctly.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Berend Otten Monday, May 13, 2013 6:51 AM
    Thursday, May 9, 2013 7:09 AM
    Moderator

All replies

  • There are two types of disablement of add-ins, soft and hard.

    In a soft disablement you should be able to go to Word > Options > Add-ins and from the Manage menu select Com Add-in and press Go. If your add-in is listed but unmarked, you should be able to mark the checkbox and assuming there are no errors listed, the add-in tab will reappear.

    In a hard disablement from the Manage menu of the Word > Options > Add-ins dialog you have to select Disabled Items and if your add-in is listed you attempt to re-enable it from there. Also note on this dialog that it says that you may have to restart Word in order for it to re-enable the add-in.

    Both of the above methods assume that your add-in is signed with a certificate from an authorized authority. Only if you are running your add-in on your Visual Studio development machine will a Personal Signing Certificate be allowed.

    In Office 2010 on an end user machine, and assuming that you are not using a Click-Once Install, add-ins load into the Local Machine hive of the registry.  On your Visual Studio development machine the add-in you create and debug is loaded into the Current User hive of the registry.

    If the problem you are experiencing is occurring on your development machine I suggest that you take a look at both the Current User and Local Machine registry settings for the add-in.  What you are looking for is the Load Behavior setting for the add-in, which must be set to “3” for the add-in to load.

    For the Current User settings look here:
    HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins

    For the Local Machine setting on a 64bit OS look here:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\Word\Addins
    If your OS is 32bit then eliminate the “Wow6432Node” directory.

    Hope this helps


    Kind Regards, Rich ... http://greatcirclelearning.com

    Wednesday, May 8, 2013 1:50 PM
  • Thanks for your reply! 

    I tried to recover from the soft- and hard disablement without any luck. The add-in is shown unchecked, it stays that way even after changing the checkbox status. When selected the add-in in the "COM enable dialog", it shows that the add-in LoadBehaviour is set to "deleted".

    Then in the registry I found the property LoadBehaviour, precisely at your given offset. The current user setting and local machine setting for LoadBehaviour is (already) set to "3".

    Tested again, no change: no Ribbon tab page and no add-in. Then I removed the registry settings, assuming that the properties will be created again when they don't exist.

    Also, in my development environment (Windows 2008 R2, Visual Studio 2010 Pro, Office 2010 Pro) I created a test certificate for my add-in. Later, when the project is ready to be published, I will use the click once option to deploy.

    Are there more options to completely reset my VS project? As if I created it from fresh? Do you think a rename of the project will help?

     


    Wednesday, May 8, 2013 5:49 PM
  • Make sure you have no other Word versions running. Use Task Manager to check this or simply log out of your machine and then log back in.

    Since you have registry entries in both Current User and Local Machine, it might be confused about which version to load. I would only have 1 add-in setting in the registry, or you should point the Manifest path in the Local Machine add-in to your Visual Studio Solution's release folder.

    To disable the Local Machine version change the Load Behavior to "2" or as I said, leave it set to 3 but point the Manifest path to your Solution's Release folder in you Visual Studio Project Library. 


    Kind Regards, Rich ... http://greatcirclelearning.com

    Wednesday, May 8, 2013 6:00 PM
  • Hi Berend

    A colleague of mine was once fond of quoting "If it hurts, stop doing it". That's my reaction to reading your steps to reproduce. When you choose to stop debugging you're basically "crashing" your add-in, as far as Word is concerned. This will make Word black-list it, especially after you confirm to Word that it should disable the add-in.

    One thing I haven't seen suggested yet in this thread is that you run "Clean Build" from within your VSTO project. That should clean up the Registry entries the debug process creates.

    It's also a bad idea to perform an installation on your developer machine where you want to debug. Run an uninstall in Windows.

    If your manual "tweaking" in the Registry has resulted in Clean Build and uninstall not being able to remove Registry entries, remove them by hand.

    In the Word UI, where you're seeing the Add-in listed but unchecked use the Remove command to remove it from the list (assuming Clean Build and uninstall haven't already done so).

    Now try running in Debug mode again and DO NOT give the command to stop debugging. Close the Word application so that the add-in unloads correctly.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Berend Otten Monday, May 13, 2013 6:51 AM
    Thursday, May 9, 2013 7:09 AM
    Moderator
  • Thank you both for the tips that lead to my solution. To sum it up, here are the steps:

    - Uninstall any previous version of the AddIn

    - Clean project and solution

    - Manually clean registry (to be 100% sure)

    - Validate all COM registrations in Word, delete all previous version of AddIn

    - Restart development environment 

    - Killed all instances of Office clients with task manager

    - Build the solution and project

    Note: Check the certificate settings with MMC (loaded local computer certificate and current user certificate) deleted all existing certificates to the AddIn. Then I reimported a newly created certificate to the "vertrouwde basiscertificaties" sub nodes.

    Last but not least: Start debugging the AddIn without breaking the debug process. 

    Now Word starts with the newly created AddIn in a fresh looking Ribbon!

    Kind regards,

    Berend Otten

    Monday, May 13, 2013 7:08 AM