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