Can I create a new folder with a Visual Studio Item Template
Asked Answered
B

1

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?

Barbary answered 1/10, 2009 at 15:48 Comment(0)
B
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.

Barbary answered 1/10, 2009 at 19:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.