For the case when someone needs this:
I tried to add an interface to the class and did not know how to get the interface name to be composed of the class name, such as I + $fileinputname$ .
In the *.vstemplate file, just use I$fileinputname$.cs for the TargetFileName interface:
<TemplateContent> <ProjectItem TargetFileName="$fileinputname$.cs" ReplaceParameters="true">SomeClass.cs</ProjectItem> <ProjectItem TargetFileName="I$fileinputname$.cs" ReplaceParameters="true">ISomeClass.cs</ProjectItem> </TemplateContent>
In the ISomeClass.cs file ISomeClass.cs again use I$fileinputname$ for the interface name:
namespace $rootnamespace$ { public interface I$fileinputname$ { } }
Important:
Set the action of assembling the SomeClass.cs and ISomeClass.cs to None , since this project is intended to create a .zip file, not a .dll or .exe file, the code files are not compiled or are not considered as code for the purposes of the assembly ( .vstemplate file has VSTemplate assembly VSTemplate .).
As a result, when SomeClass.cs added as an Item template , the corresponding ISomeClass.cs interface is ISomeClass.cs .

source share