As a web developer consistency and organization is a key factor in efficient, scalable and maintainable projects. Visual Studio has a nice little feature called Export Template Wizard that will create templates which future projects can be based upon. I use this tool to create website structures I use over and over, without searching and adding items at the start of the project or during the website development process. Everything will be available to me in a consistent structure every project.
Creating a reusable template first starts with creating a new website and adding the necessary elements that are used in every project. I have a seperate folder where I keep this template for later user or adding or deleting items in the future and recreating the template. This post is using Visual Studio 2008. Some items used in this template are listed below:
I also included pre-existing folders
What you include depends on your preference. If you have any suggestions please leave a comment.
The next step is to export this template to a zip file for reuse in Visual Studio. Navigate to 'File' > 'Export Template...'.
If this is not available which most likely it isn't, right click at the top of Visual Studio near the menu or toolbars and you get a long list of toolbar selections.
Select 'Customize...' at the very bottom. The 'Customize' dialog will appear.
You should be on the 'Command' tab.
Select 'File' from the 'Categories' list box.
Under the 'Commands' listbox select and drag 'Export Template...' to the 'File' menu and drop it anywhere.
We now can export our website to a reusable template.
Export Template Wizard
A dialog window called 'Export Template Wizard'
will appear to 'Choose Template Type'
Make sure the 'Project template' radio button is selected.
Next select from the 'From which project would you like to create a template?' dropdown select the template we are going to export from the solution.
Last select the language you would like this template to be from the 'What language category should this template appear under in the New Project dialog box?' dropdown.
Click 'Next >'.
Next we need to Select Template Options.
Options include choosing a Template icons, Template name, Template description, Automatically import the template into Visual Studio, and Display an explorer window on the output files folder.
Input your necessary options and click Finish.
Windows explorer will now open to the My Exported Templates folder in windows explorer, displaying a zip file that contains all the files of you website template.
Import Website Template
After creating our website template we can now put it to use. Create a new website in Visual Studio. Look under the heading My Templates for the name of the template you created and click the OK button. Our website templated is loaded with the structure we want and ready to use by your development team.
Looking at many websites with different stuctures can be very frusturating and at times can be time intensive especially on time sensitive projects. Visual Studio offers a nice way to counter this by offering the ability to create your own templates without the need of searching for necessary files that are used in every project and remembering where they should go.
Download - Website Template.zip (129.88 kb)