About The Author
Michael Flynn is a Web Developer at Terralever, an interactive marketing agency based in Tempe, AZ. He specializes in web technologies that include C# .NET, SQL, XML, AJAX, jQuery, Flash, and also skills in Photoshop and Illustrator. He was been involved in web development since 1998, and earned a Bachelors and Masters degree in Computer Engineering and Computer Science from the Univerisity of Louisville and holds an MSCT certificate in Web Applications.
Calendar
<<  September 2010  >>
SMTWTFS
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Export A Website Template In Visual Studio

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.

Create Website

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:

  • robots.txt
  • sitemap.xml
  • web.config
  • web.sitemap
  • global.asax
  • masterpage.master
  • stylesheet.css
  • reset.css
  • forms.css
  • basepage.cs
  • utility.cs
  • cssfriendly.dll

I also included pre-existing folders

  • App_Browsers
  • App_Code
  • App_Data
  • App_Themes
    • Default
      • Images
  • Assets
  • Bin
  • Script

What you include depends on your preference.  If you have any suggestions please leave a comment.

 

Export Template

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.

Conclusion

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)

Posted on 8/10/2008 3:18:00 PM by cblaze22

Permalink | Comments (17) | Post RSSRSS comment feed |

Categories: Visual Studio

Tags:

Currently rated 5.0 by 6 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5