I'm trying to make a simple proof of concept type visual studio template, but I can't seem to get the built in variables to work like they should. I'm trying to follow the documentation here https://learn.microsoft.com/en-us/visualstudio/ide/template-parameters?view=vs-2019 but it's not working.
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>Readers</Name>
<Description><No description available></Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>Readers</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<Project TargetFileName="Readers.csproj" File="Readers.csproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="true" TargetFileName="App.config">App.config</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="DBAccess.cs">DBAccess.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$safeprojectname$.cs">MainReader.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="packages.config">packages.config</ProjectItem>
<Folder Name="Properties" TargetFolderName="Properties">
<ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.resx">Resources.resx</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Resources.Designer.cs">Resources.Designer.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Settings.settings">Settings.settings</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Settings.Designer.cs">Settings.Designer.cs</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="true" TargetFileName="ReaderBase.cs">ReaderBase.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>
This is what I came up with following that example. This is basically the same template file that was generated when I did Project -> Export Template in visual studio except for the line.
<ProjectItem ReplaceParameters="true" TargetFileName="$safeprojectname$.cs">MainReader.cs</ProjectItem>
which should rename the MainReader.cs file to the name of the project when I make a new one using this template. It does not, whenever I make a new project with this template that file keeps the name MainReader.cs. I've tried adding the ext_ extension to the name, I've tried using the variable inside the brackets instead of outside and both. There has to be something else I'm missing or maybe this just isn't a thing any more. The process I've been using to get the template in is using the export template wizard, extracting that zip file, changing the .vstemplate file, putting the whole thing back in a zip fil, and then finally replacing the zip file in exported templates folder for visual studio. There may be another place I need to put the revised zip file but I'm not sure.