Installing Visual Studio AddIns for All Users
Whilst writing the installer for WebGAC, I was faced with some challenges trying to make the Add-In install for all users on the system. The MSDN documentation for Add-In registration generally recommends placing the files into the user’s My Documents directory. It’s All Users solution is to place it into the Shared Documents directory. The problem I faced was that that directory has moved drastically on Windows 7 – to the point where as far as I can tell, Visual Studio (2008 at least) is no longer searching there by default.
It turns out, though, that there is an easy solution.
Using some other Add-Ins as examples (such as JetBrain’s ReSharper) the simplest strategy seems to be:
- Install your AddIn into a standard application install directory (eg, the “Application Folder” pointed at [TARGETDIR] in your Visual Studio Setup project, or C:\Program Files\AppName if doing this manually)
- Create a string value in HKEYLOCALMACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\AutomationOptions\LookInFolders in the registry, with key [TARGETDIR] and value being something descriptive for your application. Note that [TARGETDIR] is a special substituted variable in Visual Studio Setup projects – if you’re doing this manually, you should instead use the actual path to the directory containing your .addin file (eg C:\Program Files\AppName)
When you start Visual Studio, your AddIn should be loaded. You can also verify this path by opening Tools -> Options, and looking at the list in Environment -> Add-in/Macros Security.
This solution also has the advantage of not placing application files in user directories – hence preventing the user accidentally removing them, and allowing Windows to apply normal Program File protections to the files too.