Concatenate project name to create Template in Visual Studio 2013 C #

3

I'm creating a project template and editing the .vstemplate file has something like this:

    <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
  <TemplateData>
    <Name>Negocio</Name>
    <Description>&lt;No description available&gt;</Description>
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType>
    </ProjectSubType>
    <SortOrder>1000</SortOrder>
    <CreateNewFolder>false</CreateNewFolder>
    <DefaultName>Negocio</DefaultName>
    <ProvideDefaultName>true</ProvideDefaultName>
    <LocationField>Enabled</LocationField>
    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
    <Icon>__TemplateIcon.jpg</Icon>
  </TemplateData>
  <TemplateContent>
    <Project TargetFileName="SIIM.Negocio.csproj" File="SIIM.Negocio.csproj" ReplaceParameters="false">
      <Folder Name="Base" TargetFolderName="Base">
        <Folder Name="Interface" TargetFolderName="Interface">
          <ProjectItem ReplaceParameters="true" TargetFileName="I'$safeprojectname$'.cs">IPesquisarEstruturaSIIMN.cs</ProjectItem>
        </Folder>
        <ProjectItem ReplaceParameters="true" TargetFileName="'$safeprojectname$'N.cs">PesquisarEstruturaSIIMN.cs</ProjectItem>
      </Folder>
     </Project>
 </TemplateContent>
</VSTemplate>

How do I change the name of the "TargetFileName" so that it is dynamic according to the name that the user types in the dialog box? I would like to make a concatenation "I" + "$ safeprojectname $" + ".cs" can anyone help me?

    
asked by anonymous 16.04.2015 / 15:57

1 answer

1

Actually I have to use ProjectItem as follows:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>WebApiConsulta.cs</DefaultName>
    <Name>WebApiConsulta</Name>
    <Description>&lt;No description available&gt;</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.png</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="Consulta/$fileinputname$.cs" ReplaceParameters="true">ConsultaGrupoProjeto.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

In this case it will be accessing the query folder, if I want to use a middle name that "default" would look something like this:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>WebApiConsulta.cs</DefaultName>
    <Name>WebApiConsulta</Name>
    <Description>&lt;No description available&gt;</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.png</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="NomeQueEuQUero$fileinputname$OutroNOme.cs" ReplaceParameters="true">ConsultaGrupoProjeto.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>
    
17.04.2015 / 17:41