Hey all!
I have created a template for a project of mine but when I see my output classes (the ones in the new project using the template I created), they keep the names from the original classes when I want them to have the name of the new project. Here is my code:
< VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
< TemplateData>
< Name>ServiceTemplate</Name>
< Description>Simple Windows service</Description>
< ProjectType>CSharp</ProjectType>
< ProjectSubType>
</ ProjectSubType>
< SortOrder>1000</SortOrder>
< CreateNewFolder>true</CreateNewFolder>
< DefaultName>ServiceTemplate</DefaultName>
< ProvideDefaultName>true</ProvideDefaultName>
< LocationField>Enabled</LocationField>
< EnableLocationBrowseButton>true</EnableLocationBrowseButton>
< Icon>__TemplateIcon.ico</Icon>
</ TemplateData>
< TemplateContent>
< Project TargetFileName="ServiceTemplate.csproj" File="ServiceTemplate.csproj" ReplaceParameters="true">
< ProjectItem ReplaceParameters="true" TargetFileName="Program.cs">Program.cs</ProjectItem>
< Folder Name="Properties" TargetFolderName="Properties">
< ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
</ Folder>
< ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$_Installer.cs">ServiceTemplate_Installer.cs</ProjectItem>
< ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$_Installer.Designer.cs">ServiceTemplate_Installer.Designer.cs</ProjectItem>
< ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$_Service.cs">ServiceTemplate_Service.cs</ProjectItem>
< ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$_Service.Designer.cs">ServiceTemplate_Service.Designer.cs</ProjectItem>
</ Project>
</ TemplateContent>
</ VSTemplate>
I am following what I read in these articles:
This is what I am trying to achieve. The project I am using as a template has four files, ServiceTemplate_Installer.cs, ServiceTemplate_Installer.Designer.cs, ServiceTemplate_Service.cs and ServiceTemplate_Service.Designer.cs. I export this project and generate a template. When I use the template, I would like to see ServiceTemplate replaced by the new project's name.
Any help is greatly appreciated!
Cheers,
Visual C#18
|