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.
6 Comments
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.
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 !
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…
Hello
I get the same error message, but it happens on first installation.
Any ideas?
I had to move the files to the local PC.
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)