The host application must be registered before templates can be made or the IDE can be started through the host application. But what if after you register the app you need to make changes to the registries? How can you make changes under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHostConfig\<HostID> registry and be sure that they are properly reflected in the VSTAHost\<HostID> registry and elsewhere?
There are some properties in the VSTAHostConfig hive that are not copied into the VSTAHost registry hive and may be altered without deleting the VSTAHost hive and re-running setup. These include: AppName, DefaultSettings, UserFilesFolderName and NewProjectLocation. However, if you have run a project and then change the UserFilesFolderName, you must delete the registry hive from HKEY_CURRENT_USER\Software\Microsoft\VSTAHost\<HostID>. When you run the application with “vsta /hostid <HostID>” you should get a message “<HostID> configuring the environment for first time use. This might take a few minutes”. If you don’t see this message the change did not take effect. The NewProjectLocation attribute does not seem to have this problem- each time I ran the project, the new folder specified was created whether or not I deleted the VSTAHost hive under HKEY_CURRENT_USER. The AppName and DefaultSettings may also be changed without deleting any registry hives.
Note:
UserFilesFolderName specifies the folder in My Documents that is used to store setting files.
Example:
If you specify this attribute as “USER_FILE_X\HOSTID_Y” the file “%My Documents%\USER_FILE_X\HOSTID_Y” will be created and used.
If you specify this attribute as “%SYSTEMDRIVE%:\USER_FILE_X” an attempt to create the folder “%My Documents%\%SYSTEMDRIVE%:\USER_FILE_X” will be made and fail because this is not a valid folder name. You should get an error that the setting file could not be found or is not available for writing when you attempt to run. This attribute may only be used to designate a file in My Documents.
NewProjectLocation specifies the path where the projects are stored by default.
Example:
If you specify this attribute as “PROJECT_LOCATION_X” the folder “%SYSTEMDRIVE%:\Documents and Settings\%USER%\Application Data\Microsoft\VSTAHost\<HostID>\8.0\PROJECT_LOCATION_X” will be created and used.
If you do not specify a full path, the default path “%SYSTEMDRIVE%\Documents and Settings\%USER%\Application Data\Microsoft\VSTAHost\<HostID>\8.0\%your input%” will be created and used.
If you specify this attribute as “%SYSTEMDRIVE%:\PROJECT_LOCATION_X\HostID_Y” the folder “%SYSTEMDRIVE%:\PROJECT_LOCATION_X\HostID_Y” will be created and used.
If you specify this attribute as “%FLOPPY_DRIVE%:\PROJECT_LOCATION_X” and there is a disk in the floppy drive, the folder “%FLOPPY_DRIVE%:\PROJECT_LOCATION_X” will be created and used; however, if there is no disk in the floppy drive (or you specify a drive that doesn’t exist) no folder is created nor error generated. Because no error is generated, you may want to check that the folder was created- it should appear after running the project from the command line with “vsta /hostid <HostID>”.
If any changes are made to the properties ProjectTemplatesLocation or ItemTemplatesLocation you must delete the registry hive under VSTAHost\<HostID> and re-run “vsta /hostid <host ID> /setup” from the command line. These properties are carried from the VSTAHostConfig hive to the VSTAHost hive and without first deleting and then re-running setup, the changes will not be carried over. Note: the hive that needs to be deleted is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTAHost\<HostID> not HKEY_CURRENT_USER\Software\Microsoft\VSTAHost\<HostID>.
If you change these attributes after you create a project template, when running with the command “vsta /hostid <HostID>” you may get an error message “Registration information for this application needs to be updated. To updated, log on as an administrator and run this command: vsta.exe /hostid <HostID> /setup”. You will continue to get this command until you run setup. After running setup, I got the error one more time, but was able to run without problems afterwards.
The folders specified with these attributes are not automatically created if they do not exist. If you are specifying a folder that does not exist make sure that you create the folder. In ProjectGen, the “Create Project Template” box is populated with the ProjectTemplatesLocation you specify; you will not be able to complete ProjectGen if the folder specified in this box does not exist.
The properties VSCSProjectTemplateLocation and VSVBProjectTemplateLocation are a bit more complicated to change because these properties are carried over to the “%ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\[CSharp,VisualBasic]\<Host ID>” folders. To ensure changes made to these properties are carried over, you must delete the HKEY_LOCAL_MACHING\...\VSTAHost\<Host ID> registry hive and run setup for both vsta.exe and devenv.exe (devenv is usually located at “%ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE”). These attributes are automatically set after you run ProjectGen for the first time. The values generated for these attributes are %ProjectTemplatesLocation%\[CSharp, VisualBasic]. Running ProjectGen again and using a different file will not create new registry entries.
Quick Reference:
|
Property Name |
What it Specifies |
To Make Changes |
|
AppName |
Name to appear in the IDE title bar. |
No additional steps are required. |
|
DefaultSetting |
Location of the setting file. |
No additional steps are required. |
|
ProjectTemplatesLocation |
One location of the project templates*. |
Delete the <HostID> registry hive under “HKEY_LOCAL_MACHINE\...\VSTAHost” and rerun setup. |
|
VSCSProjectTemplatesLocation |
One location of the project C# project templates.* |
Run setup for both vsta.exe and devenv.exe. |
|
VSVBProjectTemplateLocation |
One location of the VB project templates.* |
Run setup for both vsta.exe and devenv.exe. |
|
ItemTemplatesLocation |
One location of the item templates.* |
Delete the <HostID> registry hive under “HKEY_LOCAL_MACHINE\...\VSTAHost” and rerun setup. |
|
UserFilesFolderName |
Folder in My Documents to store projects and settings. |
Delete the <HostID> registry hive under “HKEY_CURRENT_USER” and rerun setup. |
|
NewProjectLocation |
Default location to store projects. |
No additional steps required. |
*Templates are stored in multiple locations. These locations include the locations specified in the registry hive as well as “%SYSTEMDRIVE%\Documents and Settings\%User%\Application Data\Microsoft\VSTAHost\%HostID%” and “%SYSTEMDRIVE%\Documents and Settings\%User%\Local Settings\Application Data\Microsoft\VSTAHost\%HostID%”. See the SDK section topic “Host Registry Settings” for more information.
Posted
May 29 2007, 02:57 PM
by
Melody