Click here to Skip to main content
Licence CPOL
First Posted 22 Apr 2011
Views 3,615
Downloads 149
Bookmarked 2 times

Customization of Project and Item Templates - Part II

By | 22 Apr 2011 | Article
Creation of Project and Item Templates in Visual Studio - Part II

Introduction

When you add a new project item in a project, whether the item file is a design file or code file, the project item template will generate initial designing or coding in the file. We can customize the item template to create a common initial design settings or coding to be generated.

Background

Part I of this article can be viewed at this link.

Creation of Item Template

Here we are creating a new ASP.NET web application which contains customized item template:

  • Create a new ASP.NET web application naming MyAspxTemplate.
  • Add a new item named ViewPage.aspx under Views folder.
  • Create initial sample design in ViewPage.aspx page.
  • Save the project.
  • Export the item template by clicking Export Template under File menu.
  • Select Item Template and Click Next.
  • Select the ViewPage.aspx checkbox item to Export and Click Next:
  • Select Item References to be included with the Template, if any:
  • Enter Template name and Description and Click Finish.

Implementing the New Item Template

Create a new ASP.NET web application using Myaspxtemplate

  • Create a new ASP.NET web application.
  • Add a new .aspx page using Myaspxtemplate.
  • You can see that the initial design was generated in the new page.

Conclusion

You can also pass custom parameters to the templates by editing the .vstemplate file of the item template project. We will see the creation of text template generators to generate multiple files for project item templates in the next part of this article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

arunsuji

Software Developer

India India

Member

I have experience in more than 10 years in microsoft technologies. Visit my blog at
http://blog.apssoft.co.in/Arunprakash/Default.aspx

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmemberSelvin23:41 22 Apr '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 22 Apr 2011
Article Copyright 2011 by arunsuji
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid