how to add item template in visual studio 2017 using Wizard










1















Description:
I'm developing a solution in which I'll call a template item with the form I want it to add.



And I wonder if this is the best solution to use or has another method.



my projectmy project



Code: calss1.vstemplate



 <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>
//Call my Form
<WizardExtension>
<Assembly>MyProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f7a1fcb8d457e160</Assembly>
<FullClassName>MyProjectWizard.WizardImplementation</FullClassName>
</WizardExtension>
</VSTemplate>


Is this method valid?
Is there another method?










share|improve this question



















  • 1





    Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

    – Crowcoder
    Nov 13 '18 at 12:00











  • yes it works, I call the form for the item I want, just want to know if there is another method.

    – Jorge Toscano
    Nov 13 '18 at 12:03












  • Or I want to know if this method is the best way to call the template item.

    – Jorge Toscano
    Nov 13 '18 at 12:06











  • To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

    – Crowcoder
    Nov 13 '18 at 13:20











  • At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

    – Jorge Toscano
    Nov 13 '18 at 14:38















1















Description:
I'm developing a solution in which I'll call a template item with the form I want it to add.



And I wonder if this is the best solution to use or has another method.



my projectmy project



Code: calss1.vstemplate



 <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>
//Call my Form
<WizardExtension>
<Assembly>MyProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f7a1fcb8d457e160</Assembly>
<FullClassName>MyProjectWizard.WizardImplementation</FullClassName>
</WizardExtension>
</VSTemplate>


Is this method valid?
Is there another method?










share|improve this question



















  • 1





    Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

    – Crowcoder
    Nov 13 '18 at 12:00











  • yes it works, I call the form for the item I want, just want to know if there is another method.

    – Jorge Toscano
    Nov 13 '18 at 12:03












  • Or I want to know if this method is the best way to call the template item.

    – Jorge Toscano
    Nov 13 '18 at 12:06











  • To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

    – Crowcoder
    Nov 13 '18 at 13:20











  • At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

    – Jorge Toscano
    Nov 13 '18 at 14:38













1












1








1


1






Description:
I'm developing a solution in which I'll call a template item with the form I want it to add.



And I wonder if this is the best solution to use or has another method.



my projectmy project



Code: calss1.vstemplate



 <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>
//Call my Form
<WizardExtension>
<Assembly>MyProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f7a1fcb8d457e160</Assembly>
<FullClassName>MyProjectWizard.WizardImplementation</FullClassName>
</WizardExtension>
</VSTemplate>


Is this method valid?
Is there another method?










share|improve this question
















Description:
I'm developing a solution in which I'll call a template item with the form I want it to add.



And I wonder if this is the best solution to use or has another method.



my projectmy project



Code: calss1.vstemplate



 <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>
//Call my Form
<WizardExtension>
<Assembly>MyProjectWizard, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=f7a1fcb8d457e160</Assembly>
<FullClassName>MyProjectWizard.WizardImplementation</FullClassName>
</WizardExtension>
</VSTemplate>


Is this method valid?
Is there another method?







c# visual-studio wizard vsix itemtemplate






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 16:07







Jorge Toscano

















asked Nov 13 '18 at 11:42









Jorge ToscanoJorge Toscano

468




468







  • 1





    Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

    – Crowcoder
    Nov 13 '18 at 12:00











  • yes it works, I call the form for the item I want, just want to know if there is another method.

    – Jorge Toscano
    Nov 13 '18 at 12:03












  • Or I want to know if this method is the best way to call the template item.

    – Jorge Toscano
    Nov 13 '18 at 12:06











  • To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

    – Crowcoder
    Nov 13 '18 at 13:20











  • At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

    – Jorge Toscano
    Nov 13 '18 at 14:38












  • 1





    Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

    – Crowcoder
    Nov 13 '18 at 12:00











  • yes it works, I call the form for the item I want, just want to know if there is another method.

    – Jorge Toscano
    Nov 13 '18 at 12:03












  • Or I want to know if this method is the best way to call the template item.

    – Jorge Toscano
    Nov 13 '18 at 12:06











  • To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

    – Crowcoder
    Nov 13 '18 at 13:20











  • At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

    – Jorge Toscano
    Nov 13 '18 at 14:38







1




1





Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

– Crowcoder
Nov 13 '18 at 12:00





Does it work? At a glance that looks like how I have done it in the past but I can't tell you from a screenshot and an xml file if it is exactly right.

– Crowcoder
Nov 13 '18 at 12:00













yes it works, I call the form for the item I want, just want to know if there is another method.

– Jorge Toscano
Nov 13 '18 at 12:03






yes it works, I call the form for the item I want, just want to know if there is another method.

– Jorge Toscano
Nov 13 '18 at 12:03














Or I want to know if this method is the best way to call the template item.

– Jorge Toscano
Nov 13 '18 at 12:06





Or I want to know if this method is the best way to call the template item.

– Jorge Toscano
Nov 13 '18 at 12:06













To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

– Crowcoder
Nov 13 '18 at 13:20





To my knowledge using a wizard is the only way to provide a custom UI for a VS template.

– Crowcoder
Nov 13 '18 at 13:20













At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

– Jorge Toscano
Nov 13 '18 at 14:38





At the time of creating the project i use the wizard to create the classes/items, my question is when I try to add new class/item i want call the same wizard to add more classes/items.

– Jorge Toscano
Nov 13 '18 at 14:38












1 Answer
1






active

oldest

votes


















0














I created a new method to call the item template using the "WizardRunKind".



This is the code I created:



 public void RunStarted(object automationObject,
Dictionary<string, string> replacementsDictionary,
WizardRunKind runKind, object customParams)
{
if (runKind.HasFlag(WizardRunKind.AsNewItem))

inputForm = new MyProjectModulo();
inputForm.ShowDialog();




Note: Just call the item with the key.snk






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280306%2fhow-to-add-item-template-in-visual-studio-2017-using-wizard%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I created a new method to call the item template using the "WizardRunKind".



    This is the code I created:



     public void RunStarted(object automationObject,
    Dictionary<string, string> replacementsDictionary,
    WizardRunKind runKind, object customParams)
    {
    if (runKind.HasFlag(WizardRunKind.AsNewItem))

    inputForm = new MyProjectModulo();
    inputForm.ShowDialog();




    Note: Just call the item with the key.snk






    share|improve this answer



























      0














      I created a new method to call the item template using the "WizardRunKind".



      This is the code I created:



       public void RunStarted(object automationObject,
      Dictionary<string, string> replacementsDictionary,
      WizardRunKind runKind, object customParams)
      {
      if (runKind.HasFlag(WizardRunKind.AsNewItem))

      inputForm = new MyProjectModulo();
      inputForm.ShowDialog();




      Note: Just call the item with the key.snk






      share|improve this answer

























        0












        0








        0







        I created a new method to call the item template using the "WizardRunKind".



        This is the code I created:



         public void RunStarted(object automationObject,
        Dictionary<string, string> replacementsDictionary,
        WizardRunKind runKind, object customParams)
        {
        if (runKind.HasFlag(WizardRunKind.AsNewItem))

        inputForm = new MyProjectModulo();
        inputForm.ShowDialog();




        Note: Just call the item with the key.snk






        share|improve this answer













        I created a new method to call the item template using the "WizardRunKind".



        This is the code I created:



         public void RunStarted(object automationObject,
        Dictionary<string, string> replacementsDictionary,
        WizardRunKind runKind, object customParams)
        {
        if (runKind.HasFlag(WizardRunKind.AsNewItem))

        inputForm = new MyProjectModulo();
        inputForm.ShowDialog();




        Note: Just call the item with the key.snk







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 11:34









        Jorge ToscanoJorge Toscano

        468




        468





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280306%2fhow-to-add-item-template-in-visual-studio-2017-using-wizard%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Darth Vader #20

            How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

            Ondo