Reputation: 2523
This is my *.vstemplate
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>Form.xaml</DefaultName>
<Name>Mapaz Form</Name>
<Description>Mapaz form.</Description>
<ProjectType>CSharp</ProjectType>
<SortOrder>10</SortOrder>
<Icon>__TemplateIcon.ico</Icon>
<ShowByDefault>false</ShowByDefault>
<TemplateGroupID>WPF</TemplateGroupID>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem SubType="Designer" TargetFileName="$fileinputname$.xaml" ReplaceParameters="true">Form.xaml</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$.xaml.cs" ReplaceParameters="true">Form.xaml.cs</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.resx" ReplaceParameters="true">Resources.resx</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.Designer.cs" ReplaceParameters="true">Resources.Designer.cs</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.da.resx" ReplaceParameters="true">Resources.da.resx</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.sv.resx" ReplaceParameters="true">Resources.sv.resx</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.zh-CHS.resx" ReplaceParameters="true">Resources.zh-CHS.resx</ProjectItem>
</TemplateContent>
</VSTemplate>
The problem is that *Resources.Designer.cs is not nested under *Resources.resx. VisualStudio is nesting *.xaml.cs under *.xaml so I don't know why the other one is not working as inteded.
I am using Visual Studio 2017.
Upvotes: 0
Views: 127
Reputation: 2523
Found the answer. For anybody who encounters the same problem this is the solution.
<ProjectItem TargetFileName="$fileinputname$Resources.resx\$fileinputname$Resources.Designer.cs" ReplaceParameters="true">Resources.Designer.cs</ProjectItem>
So the answer is to literally nest it under the *.resx file you want which is in our case the invariant one.
Upvotes: 1