Starter Project Templates (VS 2010 and .NET 4.0 Series)

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:

newproject1

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:

template1

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:

template2

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

template3

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:

template4

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:

template5

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)

61 Comments

  • I like the idea of the pre-made templates to help users out... Great work Scott and team :)

  • Thanks for sharing Scott. Great stuff.

  • I just like the seamless integrated online templates ;-) And of course, the premade templates

    Thanks Scott

  • I like the online templates, our developers can share the templates online!

  • Is it possible that I can start using ASP.NET Server Controls :) This is some of the best news for VisualStudio in a long time

    "...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..."

    Scott, more and more people are calling jQuery via Google's CDN. Obviously there's competition between Microsoft and Google so it's a tough question to answer (?) but what's your view on having the reference to jQuery 1.3.2 in the template vs CDN? Has Microsoft considered hosting the latest jQuery libraries on a CDN too? Are the default templates auto-updateable in anyway? The reference to jQuery 1.3.2 will become outdated very quickly.

    I love the idea of the canned templates for things like login pages with Membership and Forms already wired up. Would we ever see a template with support for CardSpace, OpenID, etc?

  • Nice work! Will you have a gallery like you do for MVC where people can upload templates that work out of the box with these new templates?

  • I think Online Template Gallery is a great idea, especially rating.

  • when will releash vs2010 beta2 ? I want to get it

  • Can Starter projects for Web Applications be created?

  • Can I ask you a question, which is easy and better in webforms and MVC to learn and use for web applications

  • this is a really cool feature. Most of the time when we are doing small prototype project we waste a lot of time in these small things which are not worthwhile

  • This is a great concept, making some more unknown project types more accessible.
    Will there be new templates released by Microsoft in this as well over time or is this a pure community thing?

  • Let me answer a few easy questions, as Scott won't have time for them all.

    @tforster
    "Would we ever see a template with support for CardSpace, OpenID, etc?"
    Yes, he said it "You can contribute your own templates to the gallery, rate and review submissions of others", so probably someone at one moment will get around making those templates.

    @TATWORTH
    "Can Starter projects for Web Applications be created?"
    Yes, it's pretty clear: "This will hopefully facilitate the creation of lots of useful project starter kits (of all types of projects – not just web)".

  • How much of this will be available in VS Express?

    I am also excited about the CSS based rendering. I think that unlike the complete control over ids this feature has not been announced up to now.

  • Scott,

    Will there be any support for 'Solution Templates'. For example, I think it is common for teams to implement similar projects within a solution that contain the same boilerplate code, such as 'BusinessLogic', 'Utilities', etc. It would be nice if VS supported the concept of a template solution.

    Thanks,
    Matt

  • So will there be an empty template for MVC apps as well? I tend to use integrated security for our internal web apps, so I normally take out all the account controller stuff.

  • I actually cannot wait for 2010, after using 2008 i didn't think they could really improve on it much (except performance, at times).

    With the inclusion of jQuery by default (thanks for not trying to re-invent the wheel Microsoft), and the new APIs inside of the framework, i.e. Charting. This could be one of the best releases yet.

    Whats next ??

  • I'm really glad that jQuery is in there, I love the tool. But there's currently a lot of overlap in functionality between jQuery and the ASP.NET AJAX javascript. Is there going to be any cleanup there, reducing the amount of code that is sent to the client?

  • Is it possible that the out-of-the-box controls (such as login) will be implemented in a usable fashion by modern developers? Meaning, they won't use tables for layout, will be stripped down for CSS and have no - NO - inline formatting? It would save so much time to be able to actually put this stuff you've created to use, instead of having to roll our own controls which behave themselves.

  • Very good. I used asp.net mvc, & I also wanted to pre-made master pages, css etc in asp.net. Now I'm very happy to listen that all that were included in VS-2010. Thank u for good sharing.

  • Great information! I cannot wait to get my hands on VS-2010.

  • WOW!!!!! I cannot wait to get my hands on VS-2010 :)

  • Hi, I know this isn't the place, but I seem to have run into a pretty significant bug in MVC (1.0). Where would I go about posting said bug?

  • I'd really like to see solution templates in addition to project templates, as well as the ability for Microsoft to push out updates for the standard templates in a way that is separate from the community templates, so when the next update to Silverlight or MVC or whatever comes out, it's *just there* (perhaps via WU) rather than yet-another-separate-install (for things that a template is all that's required). This is less critical since we have the web platform installer now, though, but my point is that the basic list of templates that come with VS shouldn't be static for 2 years (until the next SP or release of VS) - it should grow as new products ship from MS. When you install VS, it should immediately prompt the user if they want it to go and check for updates and it should pull down the latest and greatest project templates at that time (among other things). Anything that can keep VS incrementally improving would be a good thing.

  • Another very helpful post.
    Thanks Scott!

  • Hi Scott!! Thanks for all the great work you and your teams do. When I saw the VS2010 New Project dialog it reminded me of a kind of pet peeve about dialogs in Visual Studio. All dialogs, I believe, that feature list views and/or grid views should be resizable (and should display the 'SizeGrip' at the lower right corner), and, ** importantly **, should be "sticky" in that they remember how the user last sized it so that he/she won't have to restretch it to the optimal size every time they use it. This also includes remembering column widths in grid views (which should also be resizable). Considering dialogs tend to be increasingly complex in the amount of information they impart, and when (especially with developers) there's a likelyhood that the user has a large, possibly widescreen monitor, or two, or three at their disposal, it can be quite frustrating and puzzling that each time a dialog is displayed it displays in a scrunched-down, you-need-to-scroll, you-need-to-resize-the-columns default format. My apologies for the off-topic rant, and I have filled out tickets to this effect at Microsoft Connect. You just seem to be able to remember nearly everything so I figured what the heck.

  • The starter projects look great, but I notice there's still a seperate username field. Would love to see a version of the membership provider that has email as username.

  • Templates, awesome.

    Templates that specify folders/files in Title case, fail.

    Templates that have silly naming conventions, fail.

  • Thanks for sharing Scott, cool features.

  • Very good Scott!Thank you for sharing your knowledge!

    Talley

  • Client side ids is definitely a great feature. I would like to see also other templates that include Silverlight LOB applications. Thanks!

  • @Scott , I hope you are doing good,
    i saw vs-2010 is actually using Jquery for scripting
    i have seen there is an upcoming ajax 4.0 (microsoft ajax client side library)
    now my question is, how to integrate these 2 libraries
    is microsoft lib is going to remove features which jquery already has
    or how they will intigrate iam still very confused abt this thing.
    i will really appreciate if you put some light on this

  • I would also like to have an ability to create our own starter templates with our own common project scenarios.

    For example all projects we work on have a similar folder structure and have many common references. It will be good if we can have all this as a template and start a new project with all these on just a click.

    I don't know and wonder if its possible currently?

  • Yap really online template gallery is one of the best productive idea. Really it will help us to create seamlessly applications. Thnaks for the update.

  • @tforster,

    >>>>>> Scott, more and more people are calling jQuery via Google's CDN. Obviously there's competition between Microsoft and Google so it's a tough question to answer (?) but what's your view on having the reference to jQuery 1.3.2 in the template vs CDN? Has Microsoft considered hosting the latest jQuery libraries on a CDN too? Are the default templates auto-updateable in anyway? The reference to jQuery 1.3.2 will become outdated very quickly.

    The version of jquery in the project template can be used either locally or via an CDN (the file downloaded is the same). We won't auto-update your existing projects, although future SPs of VS will likely update the templates so that new projects use more recent versions.

    >>>>>>> I love the idea of the canned templates for things like login pages with Membership and Forms already wired up. Would we ever see a template with support for CardSpace, OpenID, etc?

    Yep - I'd expect that we'll see project templates get posted that include those features as well.

    Hope this helps,

    Scott

  • @Tyone,

    >>>>>> Nice work! Will you have a gallery like you do for MVC where people can upload templates that work out of the box with these new templates?

    That is a good suggestion! I don't know of plans yet to do this, but I expect it wouldn't be too hard for us to setup.

    Thanks,

    Scott

  • @TATWORTH,

    >>>>>> Can Starter projects for Web Applications be created?

    Yes - all types of projects are supported. The screen-shots above were actually taken using a web application project.

    Hope this helps,

    Scott

  • @Gill Cleeren

    >>>>>> Will there be new templates released by Microsoft in this as well over time or is this a pure community thing?

    Our plan is to release new templates as well as allow anyone in the community to post them.

    Hope this helps,

    Scott

  • @Stilgar,

    >>>>>> How much of this will be available in VS Express?

    All of this functionality will be in VS Express. Enjoy! :-)

    Hope this helps,

    Scott

  • @Matt,

    >>>>>> Will there be any support for 'Solution Templates'. For example, I think it is common for teams to implement similar projects within a solution that contain the same boilerplate code, such as 'BusinessLogic', 'Utilities', etc. It would be nice if VS supported the concept of a template solution.

    I talked with someone who thinks this is coming with Beta2 - although I haven't received confirmation for sure yet.

    Hope this helps,

    Scott

  • @Joe,

    >>>>>>> So will there be an empty template for MVC apps as well? I tend to use integrated security for our internal web apps, so I normally take out all the account controller stuff.

    I hope so - I've been bugging the team about that a lot the last few months. It is on their feature list to get done for VS10.

    Hope this helps,

    Scott

  • @Craig,

    >>>>>> I'm really glad that jQuery is in there, I love the tool. But there's currently a lot of overlap in functionality between jQuery and the ASP.NET AJAX javascript. Is there going to be any cleanup there, reducing the amount of code that is sent to the client?

    The ASP.NET AJAX team is working to factor the ASP.NET AJAX libraries so that you only need to bring down the functionality you use. You'll see this reflected in new features going forward as well as in some existing ones.

    Hope this helps,

    Scott

  • @Furiant,

    >>>>>> Is it possible that the out-of-the-box controls (such as login) will be implemented in a usable fashion by modern developers? Meaning, they won't use tables for layout, will be stripped down for CSS and have no - NO - inline formatting? It would save so much time to be able to actually put this stuff you've created to use, instead of having to roll our own controls which behave themselves.

    Yes - the template above will not use tables for the login controls. With ASP.NET 4.0 all of the built-in controls can be used without needing tables (except for GridView - since it is by design a table).

    Hope this helps,

    Scott

  • @Matt,

    >>>>> Hi, I know this isn't the place, but I seem to have run into a pretty significant bug in MVC (1.0). Where would I go about posting said bug?

    Feel free to email it to me (scottgu@microsoft.com) and I can then forward it to the team. Alternatively you can post it in the MVC forum on www.asp.net

    Hope this helps,

    Scott

  • @EricTN,

    >>>>>>> Hi Scott!! Thanks for all the great work you and your teams do. When I saw the VS2010 New Project dialog it reminded me of a kind of pet peeve about dialogs in Visual Studio. All dialogs, I believe, that feature list views and/or grid views should be resizable (and should display the 'SizeGrip' at the lower right corner), and, ** importantly **, should be "sticky" in that they remember how the user last sized it so that he/she won't have to restretch it to the optimal size every time they use it. This also includes remembering column widths in grid views (which should also be resizable). Considering dialogs tend to be increasingly complex in the amount of information they impart, and when (especially with developers) there's a likelyhood that the user has a large, possibly widescreen monitor, or two, or three at their disposal, it can be quite frustrating and puzzling that each time a dialog is displayed it displays in a scrunched-down, you-need-to-scroll, you-need-to-resize-the-columns default format. My apologies for the off-topic rant, and I have filled out tickets to this effect at Microsoft Connect. You just seem to be able to remember nearly everything so I figured what the heck.

    This dialog actually is resizable (although there is no grip displayed in the bottom right). You can't size the different columns (the left and right columns are fixed), but the list in the middle will get bigger as you resize the overall dialog.

    Hope this helps,

    Scott

  • @John,

    >>>>> I would like to see similar starter project templates for WPF applications. Will WPF starter project templates be available in VS 2010?

    We won't have a complete WPF application starter project in the box, but will have several available online (via the online gallery I showed above) that you'll be able to install and use.

    Hope this helps,

    Scott

  • @praveen,

    >>>>>> i saw vs-2010 is actually using Jquery for scripting. i have seen there is an upcoming ajax 4.0 (microsoft ajax client side library). now my question is, how to integrate these 2 libraries

    The good news is that you can easily integrate the two! We'll post more samples shortly that demonstrate how to do this.

    Thanks,

    Scott

  • @Akash,

    >>>>>>> I would also like to have an ability to create our own starter templates with our own common project scenarios. For example all projects we work on have a similar folder structure and have many common references. It will be good if we can have all this as a template and start a new project with all these on just a click. I don't know and wonder if its possible currently?

    Yes - you will be able to-do this with VS 2010.

    Thanks,

    Scott

  • It's really nice that CSS based rendering instead of table based rendering for the built-in server controls has been implemented ! Waiting for thoses posts !

  • Hey,

    Am I missing something?!? I can't see this feature in the BETA that I am running? Am I right in thinking that it will only ship with the final release?

    Gary

  • Hey,

    Never mind, I just read your original post again, and I see that you are using BETA 2 of Visual Studio 2010. Looks like I will just have to wait :-)

    Gary

  • Awesome! I can hardly wait.

    jQuery included and "no more ctrl_ mangled names"!!!

  • Is there a test project for the ASP.NET application project template like in MVC?
    That would be great!

  • This is a nice feature, particularly with the online gallery.. A nice addition would be the ability to point this to a custom repository of templates, perhaps fed by VSTFS. This way a company can create multiple custom templates and have them easily distributed to their development staff.

  • Hi
    I can't see these default site template or empty site template in beta which i download..??

  • The idea of having the templates will be a huge plus for the asp.net to stay competitive with its rivals. Some times it is just a pain to do the membership module again and again for small websites.

    Thanks scott for sharing.

  • Sorry, I have been exploring 2010 and there are no default templates for asp.net web application that I can find.

  • WOW....

    its a very good idea. I love it. Starter Template, Empty ASP.NET WEB APPLICATION, Online Template these are amazing concept. Thank you for such good blog...

    Special Thanks to the VS2010 team

  • Can't wait to use the VS2010, just got the Windows 7 yesterday in the launch event - WOW its awesome

  • This is more of out of the topic question, but what software do you use for the screenshots? You have those nice circles around highlighted areas and the default Windows Snipping Tool doesn't have that functionality.

    Please share your wisdom. Also since I'm going of track with this question I might as well ask what software you use for creating screencasts?

  • @Sidequest Bob,

    >>>>>> This is more of out of the topic question, but what software do you use for the screenshots? You have those nice circles around highlighted areas and the default Windows Snipping Tool doesn't have that functionality. Please share your wisdom.

    I use a product called "Snagit" to-do all of my screen-shots. I find it works really well and it includes functionality to highlight things within the screenshot before saving it.

    Hope this helps,

    Scott

Comments have been disabled for this content.