I'm very excited to see this product so close to fully baked.  It's already light years ahead of web forms, but being in the middle of the first major rewrite of the site in who knows how long, I'm just not quite ready to bet my job on it.  (I am using it for a friend's site though)

That said, this post is just about the gotchas I've bumped into while trying to get myself grounded.  It's kind of some notes I'll be using for my presentation at the forthcoming phillydotnet Code Camp. 

 

Where Are The Bits?

This always seems to happen with MS's new bits.  It becomes difficult to know what and where everything is.  Well as of now, there are 3 components you will want (assuming you already know you need Visual Studio 2008):

  • ASP.NET 3.5 Extensions Preview - This is the primary download.  Install first
  • MVCToolkit - This download contains a project with some very handy extension methods that will help you recoup some of the functionality that sacrificing WebForms forces you to make.  At the time of this writing there are a number of bugs with this project, so I would recommend adding the project to your solution, rather than just using the dlls directly.  (Things like link errors, and XHTML validation failures). 
  • MVCContrib - Finally, this is an open source project on CodePlex that is focusing on adding the following (ripped shamelessly from the link provided)
    • IoC container controller factories for the popular containers: StructureMap, Windsor, Spring.Net, etc (i.e. whoever wants to contribute others)
    • Extra view helpers
    • Generic test doubles to aid unit testing
    • Visual Studio - Code Snippets
    • Resharper Live Templates

Where to Learn

I'm going to be posting some of my experiences here, but if you really want to get the best overview, start with Scott Guthrie's initial posts.  (Note that I started to put this list together myself, and then realized that Eilon Lipton had already compiled every single article I was going to link, and a few other.)

 

Ok, now on to a few issues I'm sure you'll run into as you start working with this code.

 

Problems With the Project Templates

Can't Access Controls in Code Behind

The first bug you're likely to run into is that you won't have access to your server controls in the code behind.  The solution to this is to right click in the Solution Explorer, and select Convert to Web Application.  This will create the .designer.cs files that define the partial classes needed for this to work.

Development Issues

Some Server Controls Don't Work

Next, you'll find that by default, a number of server controls do not work with the asp.net framework.  This is because they require a form with a runat="server" somewhere in the page.  By default, the MVC framework does not provide this.  Generally, the input controls will have this problem.  So does the BulletedList control for some reason. 

Remember, no ViewState

Lacking the form w/ runat=server, you'll also find that you don't have ViewState available to you. 

Other Tools (Resharper)

Currently, Resharper is at version 3.1.  It's generally passable for most .net 3.5 development, but it's more of a burden than a help if you're using MVC, because the framework takes so much advantage of extension methods, anonymous types, and lambda expressions.  Basically, Resharper chokes on all of these.  I'd recommend turning off the Intellisense instead, and instead trying CodeRush for the time being.  (I'm seeing what I think of CodeRush now).