70-564 - Visual Studio 2008 Templates

Filed under: , , , , by:

Choosing appropriate project templates is very crucial, yet many times developers will choose a template they are most accustomed to or sometimes they don't simply know that there's already a template that will meet their need. Very rarely do books describe available templates and developers usually too busy to explore that end up using either the wrong kind of template or create one from scratch, where they could save a lot of time by using something that has already been developed and tested and is ready to use out of the box. Personally I know a few .NET Web Developers that still don't really understand the difference between ASP.NET Web Site and ASP.NET Web Application. That's why I thought it would be good to go through at least Web templates as those are the subject of the 70-564 exam.
There are two kinds of Web templates - Web Site and Web Project, which they can be accessed for example from the context menu of the solution.



1. Web Site templates - below is the screenshot containing all Web Site templates



  • ASP.NET Web Site - introduced in Visual Studio 2005; doesn't have a project file; all classes must be placed in App_Code folder; all classes by default don't contain namespaces; classes can be written in different languages as long as they are in separate subfolders within App_Code folder; to deploy everything must be copied to IIS folder; separate assembly can be created per page hence changes in 1 page will result in recompiling only 1 assembly; web references are added to special folder App_WebReferences; structure of the project is based on file system (folders represent physical system folders)
  • ASP.NET Web Service – this template opens ASP.NET Web Site template and adds web service file (*.asmx) and puts code-behind file to App_Code folder
  • Empty Web Site – this template creates blank ASP.NET Web Site project but without Default.aspx page, web.config file and without App_Data folder
  • WCF Service –  this template opens ASP.NET Web Site template and adds WCF service file (*.svc) and puts code-behind file to App_Code folder
  • ASP.NET Reports Web Site –  this template opens ASP.NET Web Site template and adds Default.aspx page with ReportViewer element and opens a wizard to create a new Report Data Source, which allows you to choose views or tables from which to retrieve data to strongly typed DataSet that is put in App_Code folder.Finally a local report (*.rpdl) is created
  • ASP.NET Crystal Reports Web Site –  this template opens ASP.NET Web Site template and adds Default.aspx page with CrystalReportViewer element and opens a wizard to create a new Crystal Report (*.rpt), which is being placed in the root folder
  • Dynamic Data Entities Web Site – new template (requires .NET 3.5 SP1) provides a scaffolding framework that enables you to create a data-driven application within minutes using ASP.NET Web Site template,  EntityDataSource and ADO.NET Entity Framework
  • Dynamic Data Web Site – new template (requires .NET 3.5 SP1) provides a scaffolding framework that enables you to create a data-driven application within minutes using ASP.NET Web Site template, LinqDataSource and LINQ to SQL.
2. Web Project templates - below is the screenshot containing all Web Project templates.


  • ASP.NET Web Application - introduced in Visual Studio 2003;  require project file, which defines project structure in application; contains bin folder with compiled assembly of the project; no special App_Code folder is required; all classes automatically get a namespace when added to the project;  all classes must be in one language; only visual elements and compiled assemblies must be copied to IIS folder; you can add pre-build and post-build steps during compilation; web reference is added to folder Web References
  • ASP.NET Web Service Application – this template opens ASP.NET Web Application template and adds web service file (*.asmx) with code-behind file to the root folder
  • ASP.NET Ajax Server Control – this template creates a new ASP.NET custom server control that inherits from ScriptControl, which inherits from WebControl class (base class for all ASP.NET Web server controls) and implements IScriptControl (interface with methods to define JavaScript resources of the custom control)
  • ASP.NET Ajax Server Control Extender – this template creates a new ASP.NET control extender that inherits from ExtenderControl, which inherits from Control class (class defines the properties, methods, and events that are shared by all ASP.NET server controls) and implements IExtenderControl (interface with methods to define JavaScript resources with the behavior for an extender control). This templates allows to add custom client behavior to the existing controls and extend their functionality. It can extend different types of controls (buttons, textboxes, etc.) at the same time, where normally you would have to create several custom controls that would inherit from the controls you want to extend.
  • ASP.NET Server Control – this template, known in VS2005 as Web Control Library, creates ASP.NET Server control(s) – classes that inherit from WebControl class and can be added to Visual Studio Toolbox
  • WCF Service Application  – this template opens ASP.NET Web Application template and adds WCF service file (*.svc) and with its code-behind file in the root folder.
  • Dynamic Data Entities Web Application – this is new template (requires .NET 3.5 SP1) provides a scaffolding framework that enables you to create a data-driven application within minutes using ASP.NET Web Application template,  EntityDataSource and ADO.NET Entity Framework
  • Dynamic Data Web Application – this is new template (requires .NET 3.5 SP1) provides a scaffolding framework that enables you to create a data-driven application within minutes using ASP.NET Web Application template, LinqDataSource and LINQ to SQL
All templates described above are Visual Studio 2008 default templates but you can also download custom templates or create your own ones. Creating a template is done by simply exporting your current project to the template file followed by the export wizard. In the same way you can create an item template.




I hope you've found this overview of Visual Studio 2008 templates useful and helpful in deciding what type of template to use when you're going to create a new project next time. Maybe you will need to create a data-driven web site and you will consider using Dynamic Data Entities Web Site template rather than creating your project from scratch - or maybe you will decide to create additional templates so next time you can take advantage of something you've already developed so you can write less code and play more golf.

0 comments: