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.