Project Template Potpourri

I've been working a lot with project templates and ProjectGen lately.  Here are some miscellaneous findings based on the VSTA v 2 CTP February 2008 release.

  • ProjectGen does not find hosts registered in the Wow6432Node.  This is a known issue with this build and is listed as fixed in the next release.  To work around this, register the host in the HKEY_LOCAL_MACHINE\Software\Microsoft\VSTAHostConfig registry hive as well.

  • ProjectGen fails to register the template on 64bit machines, displaying an error that neither Visual Studio or VSTA are installed.  The project template is created in the location specified on the 4th screen (manually enter the ProjectTemplatesLocation in the "Create project template" box).  The workaround is to manually register the template by running setup for vsta and devenv.


  • If the ProjectTemplateLocation is not properly registered*, ProjectGen uses the default location of "%Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates".  *Properly registered meaning that the registry entry ProjectTemplatesLocation contained a valid value and the VSTAHost\<HostID>\9.0 registry hive was not present when vsta /setup was run.

  • If the VSTAHostConfig registry hive does not contain entries for VSCSProjectTemplatesLocation and VSVBProjectTemplatesLocation (the Visual Studio C# and VB project templates location), selecting "Register template with host application" from the fourth screen of ProjectGen will create these entries based on the ProjectTemplatesLocation.  These locations will be <ProjectTemplatesLocation>\CSharp and <ProjectTemplatesLocation>\VisualBasic.

  • When using a project template descriptor file as input, changing the host item name through ProjectGen does not change both of the parameters the host item name is used for.  The host item name is used for both the HostItemName and PrimaryCookie parameters; however, only the HostItemName changes and the original host item name is used for the PrimaryCookie.

For example, here is a descriptor file made using the SDK Walkthrough:  Creating a Project Template Using the Project Template Wizard.  The variables which are assigned the Host Item Name specified on the third screen of ProjectGen are marked with an *.

<?xml version="1.0"?>

<ProjectGen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <TemplateProperties>

    <Name>ShapeAppCSharp Add-in</Name>

    <Description>A project for creating add-ins for ShapeAppCSharp</Description>

    <DefaultProjectName>ShapeAppCSharpAddIn</DefaultProjectName>

    <Icon />

  </TemplateProperties>

  <ProjectProperties>

    <HostName>ShapeAppCSharp</HostName>

    <DebugInfoExeName>C:\ShapeAppSamples\ShapeAppBasicCSharp\core\obj\Debug\ShapeAppCSharp.exe</DebugInfoExeName>

    <HostIdentifier>ShapeAppCSharp</HostIdentifier>

    <IconImageList />

    <HostItems>

      <HostItem>

        <ProxyAssemblyName>C:\ShapeAppSamples\ShapeAppBasicCSharp\proxy\bin\Debug\ShapeAppCSharpProxy.dll</ProxyAssemblyName>

        <HostItemName>ThisApplication</HostItemName> *

        <BaseType>Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.ApplicationEntryPoint</BaseType>

        <PrimaryCookie>ThisApplication</PrimaryCookie> *

      </HostItem>

    </HostItems>

    <References />

    <COMReferences />

  </ProjectProperties>

</ProjectGen>

Here is an updated version of the descriptor file made by using the above descriptor file as input in ProjectGen and changed the Host Item Name from "ThisApplication" to "AppAddIn".  Notice that the HostItemName parameter is changed; however, the PrimaryCookie parameter still has the original value.

<?xml version="1.0"?>

<ProjectGen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <TemplateProperties>

    <Name>ShapeAppCSharp Add-in</Name>

    <Description>A project for creating add-ins for ShapeAppCSharp</Description>

    <DefaultProjectName>ShapeAppCSharpAddIn</DefaultProjectName>

    <Icon />

  </TemplateProperties>

  <ProjectProperties>

    <HostName>ShapeAppCSharp</HostName>

    <DebugInfoExeName>C:\ShapeAppSamples\ShapeAppBasicCSharp\core\obj\Debug\ShapeAppCSharp.exe</DebugInfoExeName>

    <HostIdentifier>ShapeAppCSharp</HostIdentifier>

    <IconImageList />

    <HostItems>

      <HostItem>

        <ProxyAssemblyName>C:\ShapeAppSamples\ShapeAppBasicCSharp\proxy\bin\Debug\ShapeAppCSharpProxy.dll</ProxyAssemblyName>

        <HostItemName>AppAddIn</HostItemName> *

        <BaseType>Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.ApplicationEntryPoint</BaseType>

        <PrimaryCookie>ThisApplication</PrimaryCookie> *

      </HostItem>

    </HostItems>

    <References />

    <COMReferences />

  </ProjectProperties>

</ProjectGen>

 


Posted Mar 03 2008, 09:52 AM by Melody
Copyright Summit Software Company, 2008. All rights reserved.