Ver versión en español    
 
Home
10 Reasons to use MZ-Tools
MZ-Tools 6.0 for VS.NET
Editions
Features
Online Documentation
MZ-Tools SDK
Download
Purchase
Version History (RSS)  
FAQ & Support
MZ-Tools 3.0 for VB6 & VBA
Features
Online Documentation
Download (freeware)
Donations (Paypal)
Version History (RSS)  
FAQ & Support
User Reviews
Community Place
Contact  
For Add-In Developers
About
   
 
User Testimonials

I'm an avid supporter of MZ-Tools. It's a product I couldn't do without and your level of support is outstanding.

Jan Hyde (Visual Basic MVP)

You will soon wonder how you ever lived without it.

Andy Maggs

More user reviews
 
INFO: Default .AddIn file locations for Visual Studio add-ins

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005
Date: January 2008   Microsoft Visual Studio 2008
       
Introduction

Visual Studio 2005/2008 support two kinds of add-in registration: Windows registry-based (COM) and file-based registration (.AddIn XML file). When using file-based registration, an .AddIn XML file is generated that describes the add-in and the location of the add-in DLL. This article explains the folders where the add-in setup can place this .AddIn file for Visual Studio to locate it.

More Information

Visual Studio provides a dialog window to configure the folders where it will search for .AddIn files: Tools, Options window, Environment, Add-in/Macros Security section. By default, it provides several locations. Although you can add new locations, there is no need to do this. Also, you should not remove locations to avoid breaking other add-ins.

Add-ins can be installed for the current user (the one executing the setup) or for all users. In modern operating systems and corporate environments where the user should not be an administrator, it is usual that the person installing the add-in and the person who is going to use it are not the same. For this reason, you should install the add-in for all users, unless it is an add-in that you don't plan to distribute. Some of the default folders provided by Visual Studio are intended for all users, and others only for a specific user. 

All the folders include a folder placeholder (%%) that is replaced by Visual Studio to get the actual folder name. This is required because the actual name depends on the Windows operating system (Windows Vista use different names than Windows XP) and localized versions of Windows (Windows Vista does not localize folders but Windows XP does). Your setup should use the functions of the operating system (SHGetFolder, SHGetFolderPath, etc.) or of the .NET Framework (System.Environment.GetFolderPath) to get the actual folder name. Those functions receive a constant as parameter identifying the folder (CSIDL identifier) and return the actual location for the operating system. If you hardcode the values, it may not work on all the Windows operating systems or on localized systems. Notice that the Visual Studio team has made this mistake hardcoding the "Application Data" value after %ALLUSERSPROFILE% in one of the folders and as such this only works on English systems, because this folder name is localized (in Spanish is "Datos de programa"). In some cases Visual Studio uses proprietary folder placeholders (such as VSCOMMONAPPDATA) and unfortunately it seems that there is no direct way to retrieve its actual value. The default folders and placeholders are the following:

Folders for all users:

  • %ALLUSERSPROFILE%\Application Data\Microsoft\MSEnvShared\AddIns (notice that "Application Data" is hardcoded, which shouldn't because Windows XP localizes that folder)

    Examples:

    - Windows XP: "C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\AddIns"
    - Windows Vista: "C:\ProgramData\Microsoft\MSEnvShared\AddIns"

    How to get it:

    - Windows XP: replace the %ALLUSERSPROFILE% placeholder, append it "Application Data" (even in non-English versions of Windows XP) and then append "\Microsoft\MSEnvShared\AddIns". Do not use CSIDL_COMMON_APPDATA because it would return "C:\Documents and Settings\All Users\Datos de programa" in Spanish , for example, and Visual Studio will not search in that folder.
    - Windows Vista: use CSIDL_COMMON_APPDATA and then append "\Microsoft\MSEnvShared\AddIns". Notice that Windows Vista uses a junction point (a new feature of Windows Vista that is a hidden pointer to a folder) from "C:\Users\All Users\Application Data" that points to "C:\Program Data" so using CSIDL_COMMON_APPDATA just works.

    This would be the recommended folder since it is not version specific (it works for VS 2005 and 2008) but since this folder hardcodes the "Application Data" value even for non-English versions of Windows XP, you should avoid it for the reasons explained above.
  • %VSCOMMONAPPDATA%\AddIns

    Examples:

    - Windows XP: "C:\Documents and Settings\All Users\Application Data\Microsoft\VisualStudio\8.0\Addins" (9.0 for Visual Studio 2008)
    - Windows Vista: "C:\ProgramData\Microsoft\VisualStudio\8.0\Addins" (9.0 for Visual Studio 2008)

    How to get it:

    - Any Windows version: use CSIDL_COMMON_APPDATA and then concatenate "Microsoft\VisualStudio\8.0\Addins" (9.0 for Visual Studio 2008)

    Note: the MSDN documentation incorrectly states that the folder %VSCOMMONAPPDATA% is "C:\Documents and Settings\All Users"

    This is the recommended folder but notice that it is version specific.

  • %ALLUSERSDOCUMENTS%\Microsoft\MSEnvShared\AddIns (only Visual Studio 2008)

    Note 1: this folder is not documented in the MSDN documentation, but appears in the "Tools", "Options" window, "Environment", "Add-in/Macros Security" section.

    Note 2: due to a bug, this folder is not searched. A file-monitor tool reveals that Visual Studio 2008 tries to search in the physical folder "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\%ALLUSERSDOCUMENTS%\Microsoft\MSEnvShared\Addins\", so it seems that it does not replace the %ALLUSERSDOCUMENTS% placeholder at all.

Folders for the current user:

  • %APPDATA%\Microsoft\MSEnvShared\AddIns

    Examples:

    - Windows XP: "C:\Documents and Settings\<username>\Application Data\Microsoft\MSEnvShared\AddIns"
    - Windows Vista: "C:\Users\<username>\AppData\Roaming\Microsoft\MSEnvShared\AddIns"

    How to get it:

    - Any Windows version: use CSIDL_APPDATA and then concatenate "Microsoft\MSEnvShared\AddIns"
  • %VSAPPDATA%\AddIns

    Examples:

    - Windows XP: "C:\Documents and Settings\<username>\Application Data\Microsoft\VisualStudio\8.0\AddIns"  (9.0 for Visual Studio 2008)
    - Windows Vista: "C:\Users\<username>\AppData\Roaming\Microsoft\VisualStudio\8.0\AddIns"  (9.0 for Visual Studio 2008)

    How to get it:

    - Any Windows version: use CSIDL_APPDATA and then concatenate "Microsoft\VisualStudio\8.0\Addins" (9.0 for Visual Studio 2008)

    Note: the MSDN documentation incorrectly states that the folder %VSAPPDATA% is "C:\Documents and Settings\<username>\Addins"
     
  • %VSMYDOCUMENTS%\AddIns

    Examples:

    - Windows XP: "C:\Documents and Settings\<username>\<mydocuments>\Visual Studio 2005\AddIns" (2008 for Visual Studio 2008)
    - Windows Vista: "C:\Users\<username>\Documents\Visual Studio 2005\AddIns" (2008 for Visual Studio 2008)

    How to get it:

    - Any Windows version: use CSIDL_MYDOCUMENTS and then concatenate "Visual Studio 2005\AddIns" (2008 for Visual Studio 2008) 

    Note: the MSDN documentation uses incorrectly the %USERPROFILE% placeholder.

Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this

MZ-Tools 6.0 for Visual Studio .NET

You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:

Buy MZ-Tools Now Download MZ-Tools Demo

   Top