Registry settings to add Uninstall as a shell option for VSTO manifest files

vsto logo

Visual Studio Tools for the Microsoft Office System (VSTO)

I have been working on some VSTO add-ins and on deploying them, and have something to share that I didn’t find anywhere else.

First of all, let me just say that despite certain hurdles, deploying using ClickOnce has been a very pleasant experience. After following some tutorials on making an MSI, we eventually ended up simply deploying the few needed registry entries to all users, which take care of installing and trusting each add-in. Then, once the add-in is installed, it takes care of updating itself every so often.

Unfortunately, during the period of figuring this out a few users got an older version then a newer version with a new signing certificate, which is I suspect the reason why they get the following error message:

Specified argument was out of the range of valid values.
Parameter name: entryValue

Exception Text
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: entryValue
  at Microsoft.VisualStudio.Tools.Applications.Deployment.RegistryStore.Retrieve(String entryName, Object entryValue, CompareDelegate compareMethod)
  at Microsoft.VisualStudio.Tools.Applications.Deployment.MetadataStore.UpdateLastCheckedTime(String subscriptionID, DateTime newLastCheckedTime)
  at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

There is some discussion of this error here.

Anyway, I tried removing the folder: C:\Documents and Settings\%username%\Local Settings\Apps\2.0 which causes the add-ins to re-install themselves, but that didn’t fix the problem.

The second solution I tried worked, which was to uninstall the add-in and then re-install it again. One way to uninstall is to do so via Add/Remove programs (still using XP lingo), but I came across another way from this blog post at ChristophDotNet: simply run this command:

C:\Program Files\Common Files\Microsoft Shared\VSTO\9.0\VSTOinstaller.exe
     /uninstall <name-of-manifest-file.vsto>

I find this way much easier than waiting for the Add/Remove dialog to populate (takes a while on my bloated box). You can read more about the VSTOInstaller on MSDN.

After using this technique for a while, I realized one thing – to install an MSI file, you right-click on it and choose Install, and you can also right-click to Uninstall. However, with .vsto files, you can only install. Why not add the uninstall capability right there using a shell command? And now that I knew what the command was, it was trivial. First, to find out where in the registry the open command is defined, I came across this post on Nikhil’s blog. Then, I simply added an uninstall component to it:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\bootstrap.vsto.1\shell\uninstall]
@="Uninstall"

[HKEY_CLASSES_ROOT\bootstrap.vsto.1\shell\uninstall\command]
@="\"C:\\Program Files\\Common Files\\microsoft shared\\VSTO\\9.0\\VSTOInstaller.exe\" /uninstall \"%1\""

Put that in a .reg file and run it, and you’ll be able to uninstall VSTO add-ins with ease!

This post applies to VSTO version 3.0.

This entry was posted in Technology and tagged , , , , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

6 Comments

  1. Cybrduck
    Posted 2010/02/04 at 1:00 am | Permalink

    Thanks for the help! I was wondering if there was a slick way to overcome this problem, but it appears that uninstalling is pretty much how it goes.

    I can at least deploy a script file for people to use.

  2. Dennis
    Posted 2010/12/13 at 11:59 am | Permalink

    Hi MAN, how can you know once you remove this folder:
    C:\Documents and Settings\%username%\Local Settings\Apps\2.0
    All the office add in will get reinstalled ? As your method solved my problem.

    Thanks !

  3. Posted 2011/01/22 at 2:54 pm | Permalink

    Dennis, I don’t recall where I read that removing that Apps\2.0 folder would cause the add-ins to get re-installed – probably one of the pages I came across while searching…

  4. Kim Bratteli
    Posted 2011/07/14 at 9:19 am | Permalink

    Hello

    I get the same error message, but it happens on first installation.

    Any ideas?

  5. Kim Bratteli
    Posted 2011/07/14 at 9:37 am | Permalink

    I had to move the files to the local PC.

  6. Ben Thudson
    Posted 2013/07/15 at 9:38 pm | Permalink

    This post is verbose. Cut through the irrelevant stuff and get to the point- updating the registry because VSTO sucks (no wonder Microsoft replaced it with Office.js)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*


seven − 7 =

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>