Starter Project Templates (VS 2010 and .NET 4.0 Series)
 
Published: 26 Aug 2009
Unedited - Community Contributed
Abstract
In this article, Scott examines the usage of starter project templates included with Visual Studio 2010. You will learn how to work with new projects. Scott then gets into template structures in great detail with the help of screenshots. Towards the end of the article, Scott provides a short note regarding an online template gallery where developers can download templates and use them in their projects.
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 23155/ 22

Introduction

Republished with Permission - Original Article

This is the second in a series of blog posts I'm doing on the upcoming VS 2010 and .NET 4 release.

Today's post is about another small, but I think nice, change coming with VS 2010 and ASP.NET 4 when you create new ASP.NET Web projects – which is the ability to create both "Empty projects" as well as to create projects that already have some layout and common functionality included in them, and which can help you get started when building a new application.

Creating New Projects

When you use the File -> New Project or File -> New Web Site menu commands within VS 2010, you'll see a "New Project" dialog like below that allows you to filter by language and application type and select different project templates to use when creating new projects:

Figure 1

VS 2010 ships with "empty" project templates for creating new ASP.NET applications – which will create minimal projects with just the bare essentials needed to get going.  My last post in this series included a screenshot that shows what the "Empty ASP.NET Web Application" project template creates when you use it to start a new application.

Creating a New Project using a Starter Template

VS 2010 also ships with starter template projects that allow you to create a new ASP.NET application that has some layout/CSS structure and common functionality already implemented within it. 

We first tried this concept with ASP.NET MVC 1.0 – whose project template provides a master page, CSS file, JavaScript libraries, login system, and a “home” and “about” page already wired up and implemented.  VS 2010 adds support for this idea when creating new ASP.NET Web Forms projects as well. 

When you choose the default “ASP.NET Web Application” project template, you’ll find that the ASP.NET Web Forms project created already has some directories and files contained within it:

Figure 2

It includes a Site.Master master page file that provides an overall layout for the site (with headers, footers, etc), and which uses a CSS stylesheet for all styles.  It has a “Scripts” directory that contains jQuery within it (ASP.NET AJAX is available via the script manager control).  It includes a “default.aspx” and “about.aspx” pages in the root directory that are based on the master page and include some boiler plate content.  And it includes an “Account” directory that has some pages that implement a forms-based authentication system for users to log-in, register and change their passwords:

Figure 3

You can run the project without having to write any code or configure anything, and get a nice site up and running:

Figure 4

The site has full support for forms based security authentication, and is pre-wired up to use the ASP.NET Membership system for password management:

Figure 5

All of the styles and content within the site are configured using CSS, and take advantage of some of the new features with Web Forms in ASP.NET 4 – including clean client-side “id” names (no more ctrl_ mangled names – ASP.NET 4 gives you complete control over the client id), and CSS based rendering instead of table based rendering for the built-in server controls.  I’ll discuss these new Web Forms features in a lot more depth in later posts in this series (along with a lot of other features being added).

Online Template Gallery

In addition to the built-in project templates, VS 2010 also support the ability when inside the “New Project” and “Add Item” dialogs to search an online gallery of additional templates to use.  You can contribute your own templates to the gallery, rate and review submissions of others, and search and filter them by project type, keyword and community rating.  You can then easily download and install any template locally directly within the dialog:

Figure 6

This will hopefully facilitate the creation of lots of useful project starter kits (of all types of projects – not just web) that people can easily discover and use to quickly get going when building solutions.

Hope this helps,

Scott

P.S. In addition to blogging, I have been using Twitter more recently to-do quick posts and share links.  You can follow me on Twitter at: http://www.twitter.com/scottgu (@scottgu is my twitter name)

Resources



User Comments

Title: what's a proper web.configuration?   
Name: Adrian
Date: 2010-02-04 5:46:01 PM
Comment:
I have this issue with a web.config file that keeps giving me errors every time I try to access the CRTLAB-SP link within the recent connections category. Is there an example of a proper configuration of line 322, line 2 within the web.Config file? If so, I sure could use it. Thanks for your assistance.

Respectfully,

Adrian

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-20 4:35:40 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search