简体   繁体   中英

Change Project Folder Path in Visual Studio Template

I´m working in visual studio item template, but in my solution i have 6 projects and I want to include my item template all the projects. the item code project is this one:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>WebAPI.cs</DefaultName>
    <Name>WebAPI</Name>
    <Description>&lt;No description available&gt;</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.png</Icon>
  </TemplateData>
  <TemplateContent>
      <Folder Name="Base" TargetFolderName="Base">
        <Folder Name="Interface" TargetFolderName="Interface">
          <ProjectItem ReplaceParameters="true" TargetFileName="I$fileinputname$.cs">IPesquisarEstruturaSIIMN.cs</ProjectItem>
        </Folder>
        <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$N.cs">PesquisarEstruturaSIIMN.cs</ProjectItem>
      </Folder>
 </TemplateContent>
</VSTemplate>

My Question is My problem is how can I change the project target of my item template?

The template definition applies for all of Visual Studio. In order for Visual Studio to find it, copy the .vstemplate, PesquisarEstruturaSIIMN.cs, IPesquisarEstruturaSIIMN.cs, and __TemplateIcon.png files to a new folder under the Item Templates folder.
Ex: C:\\Users\\MyUser\\Documents\\Visual Studio 2013\\Templates\\ItemTemplates\\MyTemplate

Then restart Visual Studio, right click on each project, select "Add", then "New Item." You should see your template as an option under Visual C# Items.

My solution is there : visual-studio-how-to-create-a-solution-template-with-multiple-projects

It´s more eficienty to use projet template one by one.

    <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="ProjectGroup">
  <TemplateData>
    <Name>CijunMVC</Name>
    <Description>Cria um projeto MVC no padrão Cijun MVC</Description>
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType>
    </ProjectSubType>
    <SortOrder>1000</SortOrder>
    <CreateNewFolder>true</CreateNewFolder>
    <DefaultName>CijunMVC</DefaultName>
    <ProvideDefaultName>true</ProvideDefaultName>
    <LocationField>Enabled</LocationField>
    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
    <Icon>__TemplateIcon.png</Icon>
  </TemplateData>
    <TemplateContent>
    <ProjectCollection>
      <ProjectTemplateLink ProjectName="$projectname$_Entidade">
        Cijun_Entidade\entidade.vstemplate
      </ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="$projectname$_Negocio">
        Cijun_Negocio\Negocio.vstemplate
      </ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="$projectname$_Persistencia">
        Cijun_Persistencia\Persistencia.vstemplate
      </ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="$projectname$_WebMVC">
        CijunWebMVC\Web.vstemplate
      </ProjectTemplateLink>
    </ProjectCollection>
  </TemplateContent>
</VSTemplate>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM