Installing Visual Studio AddIns for All Users

By: on March 5, 2010

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 FilesAppName if doing this manually)
  2. Create a string value in HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio9.0AutomationOptionsLookInFolders 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 FilesAppName)

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.

FacebookTwitterGoogle+

2 Comments

  1. James says:

    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. idg says:

    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?

Post a comment

Your email address will not be published.

*

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>