Registering templates with the host application.

The easiest way to register a template with the host application is to use the “Register template with host application” check box found on the last screen of the Project Template Wizard (ProjectGen).  However, there are instances when a template needs to be more robust than the basic templates that can be created through ProjectGen and still registered with the host application. 

To update an existing template and register the new template with the host:

1)      Locate and unzip the existing template.

 

2)      Make any necessary changes.

 

3)      Re-zip the files, ensuring that the files are located directly in the zip folder (“Template.zip\files” not “Template.zip\Template\files”).

 

4)      Place the new template in the folder designated as the “ProjectTemplatesLocation” in the registry hive of the host application.

 

5)      Run the command “vsta /hostid <hostid> /setup” from a visual studio command prompt. 

 

The new template should now appear in the “%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\%HostID%\1033” folder or its equivalent.  When the command “vsta /hostid <hostid>” is run, the new template should appear as a choice in the templates window.

 

By checking “Register template with host application” two commands are executed:

vsta /hostid <hostid> /setup

This moves all files, including templates, from the project templates location specified in the host's registry hive to the host’s template folder hive in “%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates”.  When this command is executed any templates that were located in the specified template location, but were not registered, become registered with the host application.

 

devenv <hostid> /setup

This extracts all templates located in the host’s template folder hive (“%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates”) to the cache hive “%Program Files%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplatesCache”.


Posted Sep 10 2007, 04:08 PM by Melody

Comments

Gary wrote re: Registering templates with the host application.
on 11-04-2008 11:34 AM

In step 3, make sure that only compressed project templates (.zip files) are in the sub directories.

To clean the slate, delete these registry hives before step 5:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHost\ShapeAppCSharp\9.0 (when vsta hostid setup by admin)

HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSTAHost\ShapeAppCSharp\9.0 (when vsta hostid initial run by admin)

==

Here are the places afffected by 1. admin -- install and then by 2. admin -- vsta setup, then 3. by any user --vsta /host id initial run:

====

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTA\9.0 (when vsta installed by admin)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHostConfig (when vsta integrated app installed by admin)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHost\ShapeAppCSharp\9.0 (when vsta hostid setup by admin)

**HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSTAHost\ShapeAppCSharp\9.0 (when vsta hostid initial run by admin)

C:\Documents and Settings\All Users\Application Data\Microsoft\VSTAHost\ShapeAppCSharp\9.0  (when vsta host id setup by admin)

C:\Documents and Settings\All Users\Application Data\Microsoft\VSTA\9.0  (when vsta host id setup by admin)

C:\Documents and Settings\<Name>\Application Data\Microsoft\VSTA\9.0  (when vsta host id initial run by <name>)

C:\Documents and Settings\<Name>\Application Data\Microsoft\VSTAHost\ShapeAppCSharp\9.0  (when vsta host id initial run by <name>)

Copyright Summit Software Company, 2008. All rights reserved.