4

If this question is already answered, please point me to the correct answer. I haven't found a similar question here.

I have created an Itemtemplate with two files, which need grouping after adding them to a project.

Is it possible to add an attribute or similar to the template-definition?

So far I've following code in the MyTemplate.vstemplate-file:

.......     
<TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">filename.cs</ProjectItem>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.Properties.cs" ReplaceParameters="true">filename.Properties.cs</ProjectItem>
</TemplateContent>
.......

I know (from Stackoverflow ;-) ) how to group files manually after the adding in the Project-Explorer and this is not the answer I'm looking for.

I hope anybody knows the answer to this.

Shawn
  • 3,583
  • 8
  • 46
  • 63
Stelzi79
  • 585
  • 3
  • 12

1 Answers1

2

I would suggest you to try this way:

<TemplateContent>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">filename.cs</ProjectItem>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs\$fileinputname$.Properties.cs" ReplaceParameters="true">filename.Properties.cs</ProjectItem>
</TemplateContent>

I've found the solution here (see the "Community Additions" section). Thus sometimes comments are more useful than an original article (especially about VS templates).

Igor Kustov
  • 3,228
  • 2
  • 34
  • 31
  • Yes that looks like it ist the answer to my question. I think it's a shame that such things aren't propper documented. – Stelzi79 Apr 23 '13 at 21:42