I'm trying to create a custom item template for Visual Studio that creates multiple files. Two of those files are Resource.resx
file and a corresponding 'Resource.Designer.cs' file.
I've managed to display them as a parent-child files with this declaration in the .vstemplate
file:
<ProjectItem ItemType="EmbeddedResource" TargetFileName="$fileinputname$Resources.resx" ReplaceParameters="true">Resources.resx</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$Resources.resx\$fileinputname$Resources.Designer.cs" ReplaceParameters="true">Resources.Designer.cs</ProjectItem>
This also declared Resource.resx
as an embedded resource.
The problem I'm getting now is that the Resource.resx
file doesn't use Resources.Designer.cs
as a code behind file after creating item with this template. As soon as I add a new resource string in Resource.resx
file, it creates a new Resources1.Designer.cs
file which Visual Studio uses as a code behind from that point.
I've examined the changes made in .csproj
file before and after Visual Studio creates a new code-behind file and I found that the main reason is because there were no <LastGenOutput>
entries for Resource.resx
file.
Is there some way to declare <LastGenOutput>
through .vstemplate
or any other way to connect .resx
file with it's code-behind file without doing it manually?