On March 26, Scott Guthrie came and talked to about 200 developers in the centre of Birmingham. For six hours. Here's the abridged and annotated version of what he said about ASP.NET

Talk 1 : ASP.NET Development

The focus for ASP.NET 4.0 is to improve the end-to-end development scenarios, and to provide a productivity boost for all development within VS2010.

Improvements in VS2010

  • Intellisense in VS2010 now takes three hints for filtering items: the start of the class or member name, a substring of the name, and its 'initials' based on how it's spelled using pascal/camel casing. For example, type HttpCac, Cache or HCP and you'll get HttpCachePolicy in the intellisense list.
  • When you select a variable all instance of that variable are highlighted in the code editor window.
  • You can make box \ vertical selections in the code editor window by holding down the alt key
  • Snippet support has been added for most asp.net and http elements. Perhaps the most used of these will be "runat tab tab" to add ="server". However, there is no snippet support yet in the XAML editors.
  • When editing javascript, variable type inference informs what intellisense lists for that object. This feature works across multiple javascript files by adding comment at the top of the file referencing the other page
/// <reference path="ScriptFile1.js" />
  • Ctrl+, gives you a live search across your projects. It's essentially a Find In All Files dialog on amphetamines. Make a search and then double click on a search result to go straight to it. However there is no filter to show only class names, methods, properties etc.
  • Right click on method name : Call hierarchy window shows the call tree for a given method.
  • Right click on method name : View sequence diagram to produce visio style diagram showing call stack diagrams.
  • Generate dependency graph.
  • Pinning support for watched variables.
  • Intellitrace allows you to step backwards from a breakpoint.. Tools - Options - Intellitrace - Enable  (very cool). It will also do parallel execution analysis.
      <li>Intellitrace dumps can be saved to disk, sent over to another machine, load the dump and investigated further on that machine from exactly the same point. </li>
      <li>Intellitrace is not in Pro - it's in premium or ultimate. </li>
      <li>Intellitrace requires .NET 4.0 (need to check with ScottGu) 
        <br /></li>
  • MSDN subscribers, websitespark, bizspark and dreamspark subscribers get VS2010 on the day. MSDN subscribers get a free year's upgrade to the next level SKU.
  • VS2010 has multiple monitor support.
  • VS2010 includes new test impact analysis tools to help developers figure out which tests they should be using to test the changes they are making. (MSDN docs here and Chanel 9 vid here)

When using Intellitrace, does edit and continue work after you step backwards?
The answer depends on the IntelliTrace collection level. If the user has set the collection level to “IntelliTrace events and call information”, then edit and continue is disabled altogether. If the collection level is set to “IntelliTrace events only”, edit & continue is supported.

Does intellitrace require us to use .NET 4.0 or will it work with earlier versions of .net?
IntelliTrace works on CLR 2.0 and above.

Can you create a sequence diagram in VS, save it and then use that diagram as a basis for code generation in another project?
We do not have code generation out of the box from sequence diagrams.  It certainly would be possible to write an extension that would do that though.


  • .net4 includes a new CLR and version string.
  • VS2010 supports multi-targeting for .NET 2.0, 3.0, 3.5, and 4.0.
  • A new AppPool type is added to IIS for .net 4.0 websites when .net 4.0 is installed.
  • VS2010 will install side by side with VS2008. However VS2008 does not read VS2010 project files. Meanwhile VS2010 will auto-convert VS2008 project files to VS2010 so you'll need to maintain separate solution and project files for teams working with both versions of visual studio
  • When you set the target framework in a project properties screen in VS2010, you can select all four .net frameworks plus "Load Other Frameworks". Intellisense in VS2010 is informed by the shipped reference assemblies for the targeted framework rather than the version of .net that visual studio is built against. So when a new set of reference assemblies is released, you can 'Load Other Assemblies' to include those reference assemblies in your list of frameworks to target. (For example, reference assemblies already exist for Windows Phone & Silverlight. Theoretically you could also create reference assemblies for Mono.)

VS2010 installs safely side-by-side with vs2008 on the machine, but does vs2008 install safely side-by-side with vs2010 already on the machine?

Yes – this works fine.

Will the reference assemblies for Silverlight 4 be included with its installer or will they be a separate download? Ditto for RTM Win Phone 7.

Yes – they are included as part of the SL4 tools and Windows Phone 7 tools.  No separate download required.

Webforms 4.0

Does the ScriptManager have some sort of internal list of scripts already on the CDN so that when EnableCDN is set to true, it only seeks out jQuery or MS AJAX from the CDNs rather than a developer’s own JS files? Or is there some way to upload your own scripts to a corner of the CDN?

Yes – I believe it does.  It also, though, allows you to add other scripts to the list and/or use alternative CDNs if you want.


  • Config transform files - config transform files only work with web app projects and not website projects.
  • One click Publish mechanism - to file system, via ftp, or using WebDeploy (which also sucks out the sql for the database schema and includes them in the deployment package).
  • There will be a web deployment package for vs2010 for upgrading projects from vs08 or vs05, but new projects should use the new WebDeploy set built into vs2010. WDP2010 may not be released on April 12 with vs2010 but probably by the end of April.
  • New Package Publish Web step in project properties dialogs. (This is where you can pull the SQL schema and stuff).
    • Build Deployment Package option which pulls in all files, ACLs and SQL into one zip.
    • Zip can be published to remote server and populated remotely.
    • Zip can be imported into IIS. (RHS Actions - Deploy - Import Application)
    • WebDeploy can be scripted with Powershell.
    • WebDeploy can be used with asp.net 3.5
    • By default it will copy only the files that have changed.
    • WebDeploy is designed to work with shared hosting.

Final bits

End of Session One - 12 noon

Outside, the weather has turned and mild, grey, overcast Birmingham has turned into mild, grey, wet Birmingham with additional chances of heavier downpours as we go into the afternoon. Campaigners from world vision are apparent by the people avoiding them and those running the taste test for Magnums equally apparent for the opposite reason.

The stay at home mums outside the Odeon are wondering why 200 geeky people keep running in and out of the building.

Pre-session two questions

How do you see the relationship between WPF and Silverlight evolve? 
WPF has definitely enhanced in 4.0 as part of enhancing VS2010 with WPF. Our goal now is to keep the same programming models in sync between the two. Silverlight and WPF are both governed by the same team so there is a fair amount of cross-pollination between the two.

Is the QueryExtender control built using the dynamic LINQ library shipped earlier?


Will there be a ReMIX 10?

Possibly not, but if so then in September. Certainly in the future.

Session Two - ASP.MET MVC 2

There was heavy focus on emphasizing the new features of MVC 2 in this session, which was mostly demonstration. However, it began with a brief introduction to MVC for those who had not come across it before.

  • Webforms and MVC are complementary templating engines for ASP.NET. Web sites / apps can be 100% one or the other or hybrid.
  • MVC allows complete and full control over what is rendered to the browser. It is also geared towards better unit testing.
  • MVC 2 is a separate download for VS2008 and ASP.NET 3.5. It is built-in to VS2010 for ASP.NET 4.0
  • Like webforms, file - new project gives empty and working web app projects.
  • MVC uses a convention-based structure works for MVC.
  • MVC has three main components - Actions, Controllers,Views and Models.

Can you overload an action method with multiple signatures? 
Yes, although it’s probably easier to use default parameter values for this and more common to overload action methods by HTTP verb

// get /events/details?eventid = 3 
// if not specified, eventid given default value of 0. 
public string Details(int eventid = 0)  
  • MVC promotes separation of concerns. Which makes things\code easier to replace and easier to test.
  • Controllers pass data from a Model to a View template which then puts that data into HTML as required.
  • Model = objects that represent the data and corresponding validation and domain logic.

Scott builds a new database. Uses the Entity Framework to create the Model for the database. (File –> New -> EF Data Model).

  • New <%: variable %> syntax. HTML encodes the string value in the variable. Good for protecting against injection attacks.
  • MVC 2 pages now inherit from ViewPage<dynamic> which allows for late binding against the data type. Replacing dynamic with an actual type name will early bind it and allow intellisense against the model object in VS2010.
  • AddView wizard generates a default template to work with against a table or entity in the database. Uses the new <%: syntax.

What if your view contains more than one model?

You create a ViewModel class which encapsulates all the data items to add in and then inherit your view from ViewPage<viewmodelclass>

  • The view does not have to be strongly typed. Just inherit it from ViewPage<dynamic>

Strongly-typed html helpers

In MVC 1 = Html.TextBox("FirstName") would go find the type from the database. In MVC2  = Html.TextBoxFor(m=>m.FirstName) and it will pick up the type from the class. And pick up any renames of class properties which it wouldn't in MVC 1.

  • There are built-in snippet for these html helper methods.
  • Basically suffix MVC1 helper method name with For to get strongly typed version.
  • Scott demos the CRUD view templates based on the model.
  • Scott demos overloading the create action method by verbs. GET to show form, POST to add item to db. Note that [AcceptVerbs] decorator attribute in MVC1 still there but now also [HttpPost] [HttpDelete] etc as shortcut for [AcceptVerbs] also in MVC 2.
  • No support for HTTP OPTIONS verb.
  • New HtmlHelpers - EditorFor, DisplayFor. Both pick up the type of the variable and displays the appropriate editor or display type. Both work really well for whole classes - they'll inspect all properties and put in appropriate things for all of its properties.
  • If you have complex relationships between tables (foreign keys), editorFor doesn't automatically generate dropdowns for those foreign keys. But all is customizable. You can add data annotations to your model class or custom template annotations.

Data annotations

Add a Metadata class to Models directory

public partial class Event 
   class EventMetadata 
      public int EventId {get; set; } 

      public string Description { get; set; } 
  • Custom template file in Views/abc/EditorTemplates
  • Scaffold the template then adjust exactly as you want. Name it after the model you want to be templated. Good practice? Use EditorFor without a custom template to begin with and then use custom templates to lock it down before release.
  • Note that data annotations are picked up by editor template (not ignored)
Html.EditorFor(model=>model, "nameOfEditorTempalteToUse"); 

Validation In MVC

“Skinny controllers with fat models”: validation logic into model or service layer - not inside action methods.

  • Add custom validation stuff in metadata class
class EventMetadata 
   [Required(ErrorMessage="You msut specify a name")] 
   public string EventName {get; set; } 
  • You can plug any other validation libraries into MVC 2 should you wish to do so. (separation of concerns). Or build your own. All descriptors derive from ValidationAttribute.
  • To include client-side validation as well as server-side, include MicrsoftAjax.js and MicrosoftMVCValidation.js and add <% Html.EnableClientValidation(); %> to your view.


  • Html.Action and Html.RenderAction.
  • Allows you to encapsulate bits of common UI  with backend processing (a la user controls in webforms).
  • Create a view - set it as a partial view. Set [ChildActionOnly] on the action method. Then on another view add a call to Html.Action(method, controller);

What’s the difference between this and Html.Partial?

Partial doesn't do the data modelling stuff.


  • Allows to encapsulate Controllers, Models and Views.
  • Essentially another layer - {area}\{controller}\{action}. 
  • You can split out areas across multiple projects but the tooling isn't entirely there yet. 
  • Avoid having an area with the same name as a controller not in an area.

Can you scope a Shared folder within an Area folder?

Asynchronous Support In MVC 2

To perform asynchronous operations without blocking the working thread waiting for the response from a long operation.

Unit Testing

  • TDD support is enhanced in VS10.
  • You can generate entity template so they don't derive from EntityObject (and thus no dependence on a database)
  • Ctrl+Alt+Space toggles Intellisense into “Consume First” mode which stops it aggressively replacing classes and methods you haven't created yet. Indeed it will even add in references to phantom classes.
  • Right click on phantom class to generate class and methods. Then let test fail, then make test pass.
  • Code coverage features included

End of session

A massive thanks to Scott for talking and braving the rain, and to Dave and Phil who managed to put on this Guathon and the one in Glasgow at such relatively short notice. It worked a treat.