To remove or "unregister" project templates:
The easiest way to remove or "unregister" project templates which are registered with a host is to use the vsta and devenv setup commands. These commands get the VSTA project templates location and the Visual Studio project templates locations specified in the VSTAHostConfig registry hive and extract all templates from these locations to template caches for VSTA and Visual Studio. These processes recreate the template caches, removing all old templates prior to extracting new ones.
By omitting values for the registry entries for project templates locations and running both vsta and devenv setup, the template caches are cleared for the host for VSTA and Visual Studio. The steps to perform this process are included below. It is highly recommended to export the registry settings for the VSTAHostConfig\<HostID> and VSTAHost\<HostID> registry hives prior to performing the steps outline below.
To confirm that the project templates have been removed, open the caches and verify that the project templates exist. Perform the steps below and verify that the project templates have be removed from the caches. Tip: F5 refreshes the view for folders and registries.
ProjectGen and project templates:
A common way that project templates are unintentionally registered with the host or with Visual Studio is by using ProjectGen. ProjectGen by default places templates in the location specified by the ProjectTemplateLocation registry entry value. If a template is placed here, even if the “Register template with host application” option is left unchecked, it will be registered with the host application the next time vsta setup is run and with Visual Studio the next time devenv setup is run. ProjectGen runs both of these commands when a project template is created with the “Register template with host application” option selected. When this happens, all templates in the location specified in the ProjectTemplateLocation registry entry are registered with the host. Similarly, all templates in the locations specified in the VSCSProjectTemplatesLocation and VSVBProjectTemplatesLocation registry entries are registered with Visual Studio. If no locations are specified in the VSCSProjectTemplatesLocation and the VSVBProjectTemplatesLocation registry entries, ProjectGen creates these entries and assigns them a value based on the ProjectTemplatesLocation registry entry value. To avoid this, keep project templates that are not to be registered with the host or with Visual Studio in a separate location.
VSTA v 1 Project template locations:
VSTA location:
%Documents and Settings%\%user%\Application Data\Microsoft\VSTAHost\<HostID>\8.0\TemplatesCache\Project
Visual Studio locations:
%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\<C#,VB>\<HostID>
%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplatesCache\<C#,VB>\<HostID>
To remove project templates for VSTA v 1:
1) Open the HKey_Local_Machine\Software\Microsoft registry hive and locate the VSTAHost and VSTAHostConfig keys. Expand these hives and locate the <HostID> key. (Right click and select export to save a copy of the original registry settings for the host.)
2) In the VSTAHostConfig\<HostID> key, remove the values for the entries ProjectTemplatesLocation, VSCSProjectTemplatesLocation, and VSVBProjectTemplatesLocation.
3) Delete the VSTAHost\<HostID>\8.0 registry key.
4) From a command prompt, change the directory to %Program Files%\Microsoft Visual Studio 8\Common7\IDE and run the vsta setup command for the host.
cd "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
vsta /hostID <hostID> /setup
5) Once the vsta setup command has finished running, run the devenv setup command.
devenv /setup
VSTA v 2 Project template locations:
VSTA location:
%Documents and Settings%\All Users\Application Data\Microsoft\VSTAHost\<HostID>\9.0\ProjectTemplatesCache
Visual Studio locations:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\CSharp\<HostID>
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\<HostID>
To remove project templates for VSTA v 2:
1) Open the HKey_Local_Machine\Software\Microsoft registry hive and locate the VSTAHost and VSTAHostConfig keys. Expand these hives and locate the <HostID> key. (Right click and select export to save a copy of the original registry settings for the host.)
2) In the VSTAHostConfig\<HostID>\2.0 key, remove the values for the entries ProjectTemplatesLocation, VSCSProjectTemplatesLocation, and VSVBProjectTemplatesLocation.
3) Delete the VSTAHost\<HostID>\9.0 registry key.
4) From a command prompt, change the directory to %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE and run the vsta setup command for the host.
cd "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE"
vsta /hostID <hostID> /setup
5) Once the vsta setup command has finished running, run the devenv setup command.
devenv /setup