VSTA Configuration Entries: ItemTemplatesLocation versus VSItemTemplatesLocation

The ItemTemplatesLocation entry in the VSTA host configuration hive is used to specify the location of item templates which will only be available through the VSTA host they are registered under. This is different than the VSItemTemplatesLocation entry which is used to specify the location of item templates which will be available through Visual Studio 2008 and all VSTA hosts. 

To use the ItemTemplatesLocation entry,

1) Delete the context hive for the host. This must be done for the changes to take affect even if the ItemTemplatesLocation entry was not used previously.

2) Add the ItemTemplatesLocation entry and value to the configuration hive.

3) Run vsta setup for the host. This will extract the item templates to the VSTA item templates cache under C:\Documents and Settings\All Users\Application Data\Microsoft\VSTAHost\<HostID>\9.0\ItemTemplatesCache

The item templates stored in the ItemTemplatesLocation will now appear under the root node in the Add New Item Wizard and will not be available for other hosts or Visual Studio projects.

 

 

The VSItemTemplatesLocation entry requires the following steps to function properly:

1) Add the VSItemTemplatesLocation entry and value to the configuration hive.

2) Run vsta setup for the host. This will move the item templates from the location specified in the VSItemTemplatesLocation to the Visual Studio 2008 item templates folder under a subfolder matching the hosted: %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\Host ID.

3) Run devenv setup. Once vsta setup has moved the templates from the VSItemTemplatesLocation to the Visual Studio item templates storage folder you must run devenv setup to extract the item templates to the Visual Studio and VSTA item templates caches.

 

The item templates will appear in a category which matches the HostID under the Add New Item wizard.

 

For more information on this, see the on-line documentation on Host Configuration Registry Key Settings

ItemTemplatesLocation

If you create custom item templates for Visual Studio Tools for Applications projects, use this entry to provide a path to those templates. These items will appear in the Add New Item dialog box of the Visual Studio Tools for Applications IDE.

When you install Visual Studio Tools for Applications or run vsta.exe using the /setup switch, Visual Studio Tools for Applications does the following:

  • Copies the value of ItemTemplatesLocation to the UserFolder entry of the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHost\host ID\9.0\VSTemplate\Item.
  • Extracts the .zip files from the path that was copied to the UserFolder entry and places the files in %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache. CORRECTION: the item template is not extracted to this location, but instead to C:\Documents and Settings\All Users\Application Data\Microsoft\VSTAHost\<HostID>\9.0\ItemTemplatesCache

VSItemTemplatesLocation

If you create custom item templates for Visual Studio 2008 projects, use this entry to provide a path to those templates. These items will appear in the Add New Item dialog box of Visual Studio.

When you install Visual Studio Tools for Applications or run vsta.exe using the /setup switch, Visual Studio Tools for Applications copies the contents of the directory specified by the VSItemTemplatesLocation entry to %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\Host ID.

You must then regenerate the Visual Studio 2008 template cache so it includes the new templates. You can accomplish this by running devenv.exe using the /setup switch. Devenv.exe is usually located at %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE, but it can be installed in another location if the user overrides the default location. If you need to regenerate the template cache programmatically, you can locate devenv.exe by reading the InstallDir registry entry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0. For more information, see Devenv Command Line Switches.


Posted May 29 2009, 11:55 AM by Melody
Copyright Summit Software Company, 2008. All rights reserved.