📜 ⬆️ ⬇️

ScottGu on VS 2010 and .NET 4.0: Project Templates in VS 2010

image
This is the second article in a series of articles about the upcoming release of VS 2010 and .NET 4. [The first article on Habré ]

This time we will talk about another small, but it seems to me an interesting change that will appear in VS 2010 and .NET 4. The change concerns templates when creating ASP.NET projects, which now contain both “empty” ASP.NET projects as and new templates with a set of basic functionality. These templates can help you start creating new applications.


Creating new projects


When you use the menu item File-> New Project or File-> New Web Site in VS 2010, you will see the “New Project” dialog, as shown below, which allows you to filter the list by language and application type and select different project templates to create a new project:
')


VS 2010 contains a new “empty” project template for creating new ASP.NET applications that will allow you to create start-up projects with minimum content. In my previous article there is a screenshot that shows what the “Empty ASP.NET Web Application” template will create if you use it.

Creating new projects using Starter Template


VS 2010, among other things, contains start-up project templates that allow you to create new ASP.NET applications with some ready-made markup structure, with a set of CSS and already implemented common functionality.

For the first time we tried this solution for projects based on ASP.NET MVC 1.0, the template for this project contains the master page, CSS file, JavaScript libraries, authorization system, “home” and “about” pages. In VS 2010, this idea is implemented for new projects such as ASP.NET Web Forms.

When you select the default ASP.NET Web Application template, you will find that a new ASP.NET Web Forms project is created with a ready-made set of directories and files:



The created project contains the Site.Master master page, which defines the basic markup for the entire site (with headers, footers, etc.) and which uses the CSS file for all styles. In addition, the project has a folder “Scripts”, which contains jQuery (ASP.NET AJAX is accessible through the script manager element). The project also contains the pages “default.aspx” and “about.aspx” in the root directory, which are based on the master page and contain some basic content. The project also has an “Account” folder, which contains pages with implemented basic functionality for authorization and user registration:



You can run the project without writing a line of code or any configuration and get a nice working site:



This site fully supports forms-based authentication and supports the ASP.NET Membership system for managing passwords for users:



All the layout and design of the site’s content is based on CSS and the site uses new useful things from ASP.NET 4, such as improved work with client IDs (no more names like “ctrl_ *”, instead ASP.NET 4 gives you full control over the naming controls) and CSS-based rendering of controls instead of tables based, as before. I will talk about these new features and changes in Web Forms more fully in the next articles in this series (with a description of many other features that have been added).

Online Template Gallery


In addition to the built-in templates, VS 2010 supports the ability to search for additional templates in the online gallery within the New Project and Add Item dialogs. You can submit your own templates to the gallery, evaluate other templates and write reviews for them. It is possible to search and filter the list of templates by project type, keyword and community rating. By selecting a template, you can easily download it and install it locally via the dialog:



We hope that this functionality will contribute to creating a mass of useful templates for launching projects (not only for the web, but also for other areas), so that people can easily find and quickly get a solution for their tasks.

I hope this article was helpful to you,
Scott

PS In addition to blogging, I often use Twitter to quickly post messages and share links. You can follow me on Twitter: www.twitter.com/scottgu (@scottgu is my name on Twitter).

Progg it

Source: https://habr.com/ru/post/68083/


All Articles