ASP.NET MVC 3 Preview 1 Released, code, mvc 0 comments suggest edit

UPDATE: This post is a out of date. We recently released the Release Candidate for ASP.NET MVC 3.

Feels like just yesterday that we released ASP.NET MVC 2 to the world and here I am already talking about an early preview. In a way, we’re right on schedule. It was almost exactly a year ago that we released Preview 1 of ASP.NET MVC 2.

Today I’m happy to announce that ASP.NET MVC 3 Preview 1 is available for download. Give it a try out and let us know what you think. Some key notes before you give it a whirl:

  • ASP.NET MVC 3 Preview 1 tooling requires Visual Studio 2010
  • ASP.NET MVC 3 Preview 1 runtime requires the ASP.NET 4 runtime

As usual, to find out what’s in this release, check out the release notes. Also at the recent MVCConf, a virtual conference about ASP.NET MVC, I recorded a talk that provided a sneak peek at ASP.NET MVC 3 Preview 1. The audio quality isn’t great, but I do demo some of the key new features so be sure to check it out.

So what’s in this release that I’m excited about? Here’s a small sampling:

  • Razor View Engine which ScottGu wrote about recently. Note that for Preview 1, we only support the C# version (CSHTML). IN later previews, we will add support for the VB.NET version (VBHTML). Also, Intellisense support for Razor syntax in Visual Studio 2010 will be released later.
  • Dependency Injection hooks using service locator interface. Brad Wilson should have a few blog posts on this over the next few days.
  • Support for .NET 4 Data Annotation and Validation attributes.
  • Add View dialog support for multiple view engines including custom view engines.
  • Global Action Filters

In the next few days you should see more details about each of these areas start to show up in various blog posts. I’ll try to keep this blog post updated with relevant blog posts so you can find them all. Enjoy!

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.



38 responses

  1. Avatar for Miechu
    Miechu July 26th, 2010

    Wow, that is kind of... fast... are there any chances that mvc3 tooling will be available for vs2008?

  2. Avatar for Matt Hidinger
    Matt Hidinger July 26th, 2010

    @Miechu Unfortunately they said that MVC 3 takes a dependency on .NET 4 so VS 2008 support won't be coming.
    @Haacked Downloading now! Looking forward to the metadata and validation improvements... the complex validation I have in my app using MVC 2 has grown to become some of my least favorite code, I will branch and spike out MVC 3 to see how much it could clean up the code.
    Thanks for the preview!

  3. Avatar for Tom Frey
    Tom Frey July 26th, 2010

    @Haacked Is Intellisense for Razor supposed to be working in this preview? I followed the upgrade procedures and see the tooling support for Razor but don't get any Intellisense.

  4. Avatar for Matt
    Matt July 26th, 2010

    @Tom Frey In his MvcConf session, he said that there is no intellisense for Razor in Preview 1, but that it should be there by Preview 2.

  5. Avatar for Mike
    Mike July 26th, 2010

    Will you be releasing the Razor engine for MVC 2?

  6. Avatar for Nelson
    Nelson July 26th, 2010

    What about syntax highlighting? It appears as if there is no tooling at all for cshtml files. Is this expected, or is my install broke?

  7. Avatar for Koistya `Navin
    Koistya `Navin July 26th, 2010

    Great news! Downloading... Will Razor be the default choice as a view engine in ASP.NET MVC 3? (that would be cool)

  8. Avatar for Martin
    Martin July 26th, 2010

    @Nelson Your installation is not broken. How can you see on this page ...there is no syntax highlighting in this version.

  9. Avatar for Joe
    Joe July 26th, 2010

    Ugh...for real? I literally just ordered the MVC2 book like...a week ago. It's not even here yet.
    It's cool though - you keep putting new awesomeness out to be available to the masses. Keep it up!

  10. Avatar for Nelson
    Nelson July 26th, 2010

    @martin: Thanks :) Scott Gu seemed to sneak that post by while I wasn't looking.
    @phill: Awesome, I'v been looking forward to playing around with razor with MVC for a while now. Keep up the awesome work with this project :)

  11. Avatar for haacked
    haacked July 26th, 2010

    Hi all, there is no Intellisense or syntax highlighting for Razor in Preview 1. That will come in a later release.
    @Mike, there are no plans to release Razor for MVC 2. It requires ASP.NET 4 and MVC 2 is compiled against .NET 3.5 SP1.

  12. Avatar for Miechu
    Miechu July 27th, 2010

    @haacked @matt
    Well I don't know how things are done in mvc tooling but I don't see any reason that the tooling has to be .net 4 dependent, but even assuming that it is... wait.. just notice I can't develop .net 4 app with vs2008 (I was pretty sure I could)... hmmm... that sucks... well... keep up the great work and I'll check mvc3 sometime in the future ;)

  13. Avatar for g
    g July 27th, 2010

    Would be nice if MVC dropped server side view templates and threw everything at jquery-tmpl and script#, it would be nice to have a well supported GWT alternative, probably just pipe dreams at this point though.

  14. Avatar for Shiju Varghese
    Shiju Varghese July 27th, 2010

    Congrats for the new release

  15. Avatar for Henning Anderssen
    Henning Anderssen July 27th, 2010

    Great news.
    When do you think the final release will be finished?

  16. Avatar for Marco P
    Marco P July 27th, 2010

    awesome stuff, two requests!
    1. Support for going in/out of HTTP in a DRY way.
    2. RedirectToUrlResult which will either redirect to a specified url of look for a ReturnUrl (convention) in the params.

  17. Avatar for Rick Schott
    Rick Schott July 27th, 2010

    Great post and thanks for the MVCConf talk.

  18. Avatar for James Snape
    James Snape July 27th, 2010

    Hi Phil,
    What is your intended ship vehicle for this - out of band or with the next Visual Studio?

  19. Avatar for Synapse
    Synapse July 27th, 2010

    I'm kinda disappointed with this release.
    I was hoping for real caching and support for editing multiple entities at once (like Django formsets) but MVC3 offers only minor improvements.

  20. Avatar for haacked
    haacked July 28th, 2010

    @James Snape: Out of band for sure since we'll release before the next version of Visual Studio. We'll probably also have a version of MVC in the next Visual Studio, but we don't know yet which version it will be. There's a lot of planning still going on.

  21. Avatar for Martin Wawrusch
    Martin Wawrusch July 29th, 2010

    Any chance we will see a F# version of Razor anytime soon?

  22. Avatar for Terry
    Terry July 30th, 2010

    Is it possible to mix ViewPage (aspx) and Razor (cshtml) within the same solution? Think it is. What about hooking Razor files up to existing master (.master) pages? Any way/workaround to pull that off? Or would I have to basically have a 'duplicate' of site.master (one ViewPage and one Razor layout file) if I wasn't ready to convert entire site to Razor view engine all at once?

  23. Avatar for Martin
    Martin July 30th, 2010

    What about performance ? Have you forgot about that or is it something that you are also working on?
    I guess as more features come along, the performance will also degrade. Especially with the heavy use of Reflection and Expression Trees which i guess is the heaviest parts ?
    Just want to know if any time/work is being put into that area ? :)

  24. Avatar for Denis
    Denis July 31st, 2010

    I'd like to see T4MVC integrated in mvc.
    I mean, we all know that strongly-typed helpers are a great.

  25. Avatar for kad1r
    kad1r August 3rd, 2010

    Great new. I'm downloading right now.
    Are there training videos to learn MVC3?

  26. Avatar for Felipe Lima
    Felipe Lima August 10th, 2010

    I tried upgrading my MVC 2 project to MVC 3 preview 1 and ran into problems with my typed views. The ViewPage<T>.Model property stopped working and my project stopped running. It seems like the ViewPage<T> views were being treated as regular ViewPage classes and, thus, the Model property had a type = object. Maybe that is a issue you guys could take a look.
    Thanks for the good work!

  27. Avatar for Josh Williams
    Josh Williams August 16th, 2010

    @Felipe: Same here - all my views are broken. My Model.<Class> accessors are no longer available for my custom viewdata. It's so soon I havn't seen any posts on resolutions for this.

  28. Avatar for Josh Williams
    Josh Williams August 16th, 2010

    I think I found the issue (atleast for me) - my <%@ Import Namespace... %> messed it up for some reason. Once I removed these unused imports - it works fine. This could be a bug I guess? My import was for a simple Html Helper I made.

  29. Avatar for Feng
    Feng August 18th, 2010

    Any plan to add support for localization and theme

  30. Avatar for shawn
    shawn August 24th, 2010

    I commented a little while back, but it looks like it might have been eaten because it had a link in it. Are there any plans to add model binding support for updating objects with existing child collections? Right now if you call UpdateModel(model) on a model that has an initialized ChildItems collection, the model.ChildItems collection doesn't get updated properly. I'd be happy to submit a patch that is working for our scenarios.
    I'd also love to see some sort of baked in support for using the [Key] data annotation (or equivalent unique/primary key in LinqToSql/EF) as an index key for items in collections to avoid concurrency errors.

  31. Avatar for Scotteg
    Scotteg August 26th, 2010

    As for the name of the Dynamic View Object. I don't understand why the ViewData object itself can't just be give Dynamic traits. So people should be able to do this ViewData.Message = "Fred";.

  32. Avatar for Deke
    Deke August 31st, 2010

    I am running into the same problem as Felipe. Whenever I add a <%@ Import Namespace=... %> to an apsx page the Model loses whatever it's type was and reverts back to being a plain old object. Any work arounds for this other than the obvious (don't use import) or am I doing something wrong here?

  33. Avatar for Deke
    Deke August 31st, 2010

    Actually found the work around over here
    for the Import Namespace problem

  34. Avatar for Bill
    Bill September 2nd, 2010

    Actually I've found a way to avoid the bugs with these previews and such, I avoid them and wait for the released product. Sure I read up on the details about the upcoming features but to seriously try and use them? Never. Only time I did that was for ASP.NET 1.0 itself, and only because it was so much of an improvement over ASP.

  35. Avatar for John
    John September 7th, 2010

    This is an old post but I wanted to vote on something for MVC 3. The razor syntax is sweet by the way. My vote: I want to see stronger jquery validation support using data annotations while using jquery ajax. I would like to see the jquery validation/ajax combinations to play nice with the newer .net 4.0 features, like data annotations for validation.

  36. Avatar for Scotteg
    Scotteg September 20th, 2010

    In a masterpage it is possible to place html in the content placeholder that is only replaced if the 'child' page chooses to do so.
    It doesn't look as if this is possible in a layout page. I think this is a significant loss of functionality.

  37. Avatar for Shiv Kumar
    Shiv Kumar October 2nd, 2010

    Yes this is possible in Razor using the following in your Layout page:
    @RednderSection("someSectionName" options:true).
    What that says is the section is optional and Views can choose the render/implement the section.
    In a view in which you wish to implement this section, simply do
    @section someSetionName {
    <h2>This is an optional section, but rendered in this view</h2>

  38. Avatar for Alireza Halani
    Alireza Halani December 1st, 2010

    The Razor engine is great and surely rocks. It would be nice to have some more advance documentation..