How do you force an item template to be created in a specific project folder?

I am using project item templates in zip files in Visual Studio 2005. I have templates that we always put in specific project folders such as Forms, Exceptions, Attributes, etc. I want the user to be able to Add New Item from anywhere in the project and have it be built in the appropriate project folder. I've tried setting the path in the TargetFilename like this:
   <ProjectItem TargetFilename="Forms\form.cs" ... >
but that didn't see to work.

This was easier to do in Visual Studio 2003 style templates because your wizard code had to do all the work of processing the templates and adding the resulting files to the project. I really like the newer zip files templates in VS 2005 and would hate to have to go back to doing all the work myself.



Answer this question

How do you force an item template to be created in a specific project folder?

  • Raj Chidipudi

    You can put a \ char in front of the path of the TargetFileName attribute, then recreate the folder structure. When we see the \, we start at the root of the project when placing the file on disk.

    Craig

  • How do you force an item template to be created in a specific project folder?