Search code examples
c#visual-studiowizardvsixitemtemplate

How call a wizard to add new Item Template


I have a project template that is generated through a wizard. Now i want to add a new item template through the same wizard. How can i invoke the wizard at the moment that i add the new item template.

Example:

Add to Project Template[Add to Project Template]

Wizard/Form[Wizard/Form]

Add the new Item Template[Add the new Item Template]

Show the wizard Template[Show the wizard Template]

show the new Item/class[show the new Item/class]

Item Template Code:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>class1.cs</DefaultName>
    <Name>Myproject class1</Name>
    <Description>Myproject Class</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>Myprojectclass1.png</Icon>
  </TemplateData>
  <TemplateContent>
    <References>
      <Reference>
        <Assembly>System</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Linq</Assembly>
      </Reference>
      <Reference>
        <Assembly>System.Threading.Tasks</Assembly>
      </Reference>
    </References>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">class1.cs</ProjectItem>
    <CustomParameters>  
        <CustomParameter Name="$username$" Value="$safeitemrootname$"/> 
        <CustomParameter Name="$rootnamespace$" Value="$safeitemrootname$"/>
        <CustomParameter Name="$registeredorganization$" Value="$safeitemrootname$"/>
    </CustomParameters>  
  </TemplateContent>
    <WizardExtension>
    <Assembly>MyProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f7a1fcb8d457e160</Assembly>
    <FullClassName>MyProjectWizard.WizardImplementation</FullClassName>
  </WizardExtension>
</VSTemplate>

Solution

  • I have already found the solution, there is no other way to call the template item without being key.snk.

    Because when I call an itemtemplate I have to implement my item I chose the project created and the only way to do that is by key.snk.

    If they have a different form please respond to this question, I want to know if there are more ways to call the Item template.