15

I have successfully created (and manually edited) an Item Template that will add a number of files in one 'shot'. I want these files to all be created under a folder that should be created at the same time.

In Project Template .vstemplate files I can specify a Folder element, but the schema does not allow one in the Item Template.

Any know if this is possible or do I have to start looking at extending the IDE also?

Chris Arnold
  • 5,753
  • 5
  • 35
  • 55

1 Answers1

23

I figured it out! You just need to edit the TargetFileName attribute of the ProjectItem element and suggest a fullpath...

<ProjectItem SubType="" TargetFileName="$fileinputname$\$fileinputname$.txt" ReplaceParameters="true">template.txt</ProjectItem>

In the above example if the user names the new item 'dog' VS will create a dog folder and copy the template.txt file as dog.txt into it.

Chris Arnold
  • 5,753
  • 5
  • 35
  • 55