Introductionpan>
Visual Studio 2005 and higher versions 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 and higher: "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.
- WinWindows Vista and higher: 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 all VS versions) 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:
- WinWindows XP: "C:\Documents and Settings\All Users\Application Data\Microsoft\VisualStudio\8.0\Addins"
(9.0 for VS 2008, 10.0 for VS 2010, 11.0 for VS 2012)
- Windows Vista and higher: "C:\ProgramData\Microsoft\VisualStudio\8.0\Addins"
(9.0 for VS 2008, 10.0 for VS 2010, 11.0 for VS 2012)
How to get it: />
- AnyAny Windows version: use CSIDL_COMMON_APPDATA and then concatenate
"Microsoft\VisualStudio\8.0\Addins" (9.0 for VS 2008, 10.0 for VS
2010, 11.0 for VS 2012)
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 and
higher, not Visual Studio 2005)
- Windows XP:
"C:\Documents and Settings\All Users\Documents\Microsoft\MSEnvShared\AddIns"
- WinWindows Vista and higher:
"C:\Users\Public\Documents\Microsoft\MSEnvShared\Addins"
How to get it: />
- Any Windows version: use CSIDL_COMMON_DOCUMENTS and then concatenate
"Microsoft\MSEnvShared\Addins".
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 for Visual Studio 2008
(a bug fixed in Visual Studio 2010). 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.
- %ALLUSERSPROFILE%\Microsoft Visual Studio\Addins (only Visual Studio 2010 and
higher, not Visual Studio 2005 or 2008)
- Windows XP: "C:\Documents and Settings\All Users\Microsoft Visual
Studio\AddIns"
- WinWindows Vista and higher: "C:\ProgramData\Microsoft Visual Studio\Addins"
How to get it: />
- Any Windows version: replace the %ALLUSERSPROFILE% placeholder and then concatenate
"Microsoft Visual Studio\Addins"
Folders for the current user:
- %APPDATA%\Microsoft\MSEnvShared\AddIns
Examples:
- Windows XP: "C:\Documents and Settings\<username>\Application Data\Microsoft\MSEnvShared\AddIns"
- <- Windows Vista and higher: "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:
- WinWindows XP: "C:\Documents and Settings\<username>\Application
Data\Microsoft\VisualStudio\8.0\AddIns" (9.0 for VS 2008, 10.0 for VS
2010, 11.0 for VS 2012)
- WinWindows Vista and higher: "C:\Users\<username>\AppData\Roaming\Microsoft\VisualStudio\8.0\AddIns" (9.0
for VS 2008, 10.0 for VS 2010, 11.0 for VS 2012)
How to get it: />
- AnyAny Windows version: use CSIDL_APPDATA and then concatenate
"Microsoft\VisualStudio\8.0\Addins" (9.0 for VS 2008, 10.0 for VS
2010, 11.0 for VS 2012)
Note: the MSDN documentation incorrectly states that the folder %VSAPPDATA% is "C:\Documents
and Settings\<username>\Addins" />
- %VSMYDOCUMENTS%\AddIns
Examples:
- WinWindows XP: "C:\Documents and Settings\<username>\<mydocuments>\Visual
Studio 2005\AddIns" (2008 for VS 2008, 2010 for VS 2010, 11.0 for VS 2012)
- WinWindows Vista and higher: "C:\Users\<username>\Documents\Visual Studio 2005\AddIns" (2008
for VS 2008, 2010 for VS 2010, 11.0 for VS 2012)
How to get it: />
- AnyAny Windows version: use CSIDL_MYDOCUMENTS and then concatenate "Visual
Studio 2005\AddIns" (2008 for VS 2008, 2010 for VS 2010, 11.0 for VS 2012)
Note: the MSDN documentation uses incorrectly the %USERPROFILE% placeholder. />
Related articles
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this