Frage

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.

War es hilfreich?

Lösung

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).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top