technology from back to front

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:

  1. 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)
  2. Create a string value in HKEY_LOCAL_MACHINE\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.

by
paulj
on
05/03/10
  1. Thanks for this – great tip. When installing Intel Thread Building Blocks, I also noted that the add in would not load unless the files (xml, addin, dll) were in the actual target folder – not a subfolder of the target folder.

  2. It is OK in VS 2008 but it doesn’t work in VS 2010. At start up VS2010 removes my setting from registry.
    Any ideas?
    Also do I need to change the Addin file description?

 
 


× 5 = twenty

2000-14 LShift Ltd, 1st Floor, Hoxton Point, 6 Rufus Street, London, N1 6PE, UK+44 (0)20 7729 7060   Contact us