Search code examples
c#asp.nettemplatesitemtemplate

Creating custom item templates in VS 2010 for my web app


I've got a web app project that I'm looking at creating some item templates for in VS 2010, any new pages created from these templates need to have a using statement for my mainClasses folder. The problem is that every time a new page is created VS changes the using statement from using MyProject.mainClasses to MyProject.LocationOfPage.mainClasses. It is obviously looking for the project name so it can change the namespace accordingly but annoyingly its also changing my using statement, which breaks my project.

I think this would't be a problem if I had a website project and an App_Code folder as I wouldn't need a using statement but it's not and I can't so I'm stuck :(

Any help greatfully appreciated if anyone can figure out what I'm bumbling on about.

Cheers

Russ

PS I'm using C#.


Solution

  • You can edit the file in the template to remove the placeholder. The itemtemplate us just a zipfile with the necessary files in it. In each file the project or namespacename will be replaced on projectcreation.

    Look for placeholders like '$safeprojectname$'