ASP.NET MVC 2 Beta Released

This is the first in a series on ASP.NET MVC 2 Beta

  1. ASP.NET MVC 2 Beta Released (Release Announcement)
  2. Html.RenderAction and Html.Action
  3. ASP.NET MVC 2 Custom Validation

Today at PDC09 (the keynote was streaming live), Bob Muglia announced the release of ASP.NET MVC 2 Beta. Feel free to download it right away! While you do that I want to present this public service message.

fptopsecret

The Beta release includes tooling for Visual Studio 2008 SP1. We did not ship updated tooling for Visual Studio 2010 because ASP.NET MVC 2 is now included as a part of VS10, which is on its own schedule.

Unfortunately, because Visual Studio 2010 Beta 2 and ASP.NET MVC 2 Beta share components which are currently not in sync, running ASP.NET MVC 2 Beta on VS10 Beta 2 is not supported.

Here are some highlights of what’s new in ASP.NET MVC 2.

  • RenderAction (and Action)
  • AsyncController
  • Expression Based Helpers (TextBoxFor, TextAreaFor, etc.)
  • Client Validation Improvements (validation summary)
  • Add Area Dialog
  • Empty Project Template
  • And More!

Go Live

ASP.NET MVC 2 Beta also includes an explicit go-live clause within the EULA. You should make sure to read it has an interesting clause which references the operation of nuclear facilities, aircraft navigation, etc. ;)

More Details Please!

You can find more details about this release in the release notes. Also be on the look out for one of ScottGu’s trademark blog posts covering what’s new

I’ve started working on a series of blog posts where I will cover features of ASP.NET MVC 2 in more detail. I’ll start publishing these posts one at a time soon.

Next Stop: RC

Our next release is going to be the release candidate hopefully before the year’s end. The work from now to RC will consist almost solely of bug fixes with a few minor feature improvements and changes.

Please do play with the Beta. If you run into an issue that’s serious enough, there’s still time to consider changes for RC. Otherwise it will have to wait for ASP.NET MVC 3 which I’m just starting to think about.

I’m thinking, “man, I can’t believe I’m already thinking about version 3"!”

Links

What others have said

Requesting Gravatar... Jeff Ammons Nov 17, 2009 2:29 AM
# re: ASP.NET MVC 2 Beta Released
Oh well. Guess I'll have to go back to running my nuculer facilities with Ruby On Rails. Websites and stuff I'll switch to MVC2 however.

;-)

jeffa
Requesting Gravatar... Ryan Smith Nov 17, 2009 3:11 AM
# re: ASP.NET MVC 2 Beta Released
Aack! Just made the switch on my MVC 2 project to VS2010 now I'll have to jump from MVC 2 Preview 2 to MVC 2 RC1 right?
Requesting Gravatar... Alun Harford Nov 17, 2009 3:12 AM
# re: ASP.NET MVC 2 Beta Released
Eugh!

"To address these scenarios, the TempDataDictionary class was changed so that all the keys survive indefinitely until the key is read from the TempDataDictionary object. The Keep method was added to TempDataDictionary to let you indicate that the value should not be removed after reading. The RedirectToActionResult is an example where the Keep method is called in order to retain all the keys for the next request."

"Adding a debugger watch that shows a value from TempData will mark it for deletion. The side effect was introduced as part of the changes to TempDataDictionary."

That's seriously broken. Now you can forget to write out the contents of something in TempData ('you no longer have permission to delete that') and it'll get written out on some random page when you next check for that key. Unless you're debugging.

We're sticking with Preview 2 here.
Requesting Gravatar... Attila Nov 17, 2009 3:14 AM
# re: ASP.NET MVC 2 Beta Released
When will you release the source for this beta on CodePlex?

Thanks,
Attila
Requesting Gravatar... Michael Nov 17, 2009 3:50 AM
# re: ASP.NET MVC 2 Beta Released
When can we look forward to it being supported in VS 2010?
Requesting Gravatar... lynn Nov 17, 2009 4:01 AM
# re: ASP.NET MVC 2 Beta Released
Phil, was the team able to improve output caching scenarios with RenderAction? I believe right now you need to call an intermediate partial view to get the correct caching.
Requesting Gravatar... LaptopHeaven Nov 17, 2009 4:31 AM
# re: ASP.NET MVC 2 Beta Released
Can this be installed side-by-side with MVC 1?
Requesting Gravatar... Unknown Nov 17, 2009 4:39 AM
# re: ASP.NET MVC 2 Beta Released
When will a version for VS 2010 be released?
Requesting Gravatar... Scott Wade Nov 17, 2009 4:45 AM
# re: ASP.NET MVC 2 Beta Released
Wow...this is a total bummer (from the Release Notes): "Note Because Visual Studio 2008 and Visual Studio 2010 Beta 2 share a component of ASP.NET MVC, installing ASP.NET MVC 2 Beta on a computer where Visual Studio 2010 Beta 2 is also installed is not supported."

Sticking with MVC 2.0 Preview 2 here as well then!
Requesting Gravatar... Richard Kimber Nov 17, 2009 4:57 AM
# re: ASP.NET MVC 2 Beta Released
Really good news, but I'm using VS2010 now so I guess I'll have to wait for the next release of VS.

Rich
Requesting Gravatar... Haacked Nov 17, 2009 4:59 AM
# re: ASP.NET MVC 2 Beta Released
@lynn We basically disable outputcache on an action method called via a RenderAction call which is better behavior than the previous where the whole page would get called.

@LaptopHeaven Yes, it can be installed side-by-side.
Requesting Gravatar... Yitzhak Nov 17, 2009 5:25 AM
# re: ASP.NET MVC 2 Beta Released
What about corresponding ASP.NET MVC Futures?
Requesting Gravatar... Steve Nov 17, 2009 5:43 AM
# re: ASP.NET MVC 2 Beta Released
Any command line domain, controller, view, test generation on the horizon ? (aka. grails)

This speeds up development, rather than right click, create view (replace table with mvccontrib grid), then right click create controller, select domain objects, ad nausum.

I see new glitter (good glitter) being added, would like to see it more forward toward 'practical' :)

Happy to see the async-controllers (will make for good publishing to nservicebus!).

So - any chance we'll begin to see some scaffolding/domain focused capability in the near future from the team ?

Thanks for the updates - good stuff



Requesting Gravatar... Haacked Nov 17, 2009 6:41 AM
# re: ASP.NET MVC 2 Beta Released
@Yitzhak we're working on it.
@Steve those areas are definitely something I want to look at for possibilities for ASP.NET MVC 3.
Requesting Gravatar... Piers Nov 17, 2009 7:58 AM
# re: ASP.NET MVC 2 Beta Released
Once again you're keeping us on our toes. I look forward to tetsing out the AsyncController!
Requesting Gravatar... anton Nov 17, 2009 9:52 AM
# re: ASP.NET MVC 2 Beta Released
Do we have to wait until the next release of VS2010 before it can support MVC beta2?

So VS2010 RC1 will support ASP.NET MVC RC1? At some point you will need to get the versions aligned.
Requesting Gravatar... farrio Nov 17, 2009 10:16 AM
# re: ASP.NET MVC 2 Beta Released
Very glad to see BETA and the coming RC. When could it be released? Within the VS10 release?

And very disappointed not support VS10 Beta... :(
Is there any way we can walk around and install it into VS10 Beta even though manually?
Requesting Gravatar... Vikingo Nov 17, 2009 11:35 AM
# re: ASP.NET MVC 2 Beta Released
Hi!
What about Strongly Typed RedirectToAction and FluentHtml like mvccontrib?
Thanks
Requesting Gravatar... Shiju Varghese Nov 17, 2009 2:54 PM
# re: ASP.NET MVC 2 Beta Released
Congrats Phil. Great news.
Requesting Gravatar... Kim Cu Nov 17, 2009 3:01 PM
# re: ASP.NET MVC 2 Beta Released
Hi Phil,
Great News.
Can you give some code about new features in this build?
Thanks so much.
Requesting Gravatar... asper Nov 17, 2009 4:47 PM
# re: ASP.NET MVC 2 Beta Released
is it seamless to upgrade from mvc 1.0 to 2.0 for existing apps?
Requesting Gravatar... Richard Kimber Nov 17, 2009 5:17 PM
# re: ASP.NET MVC 2 Beta Released
Will MVC 2 Preview apps work with MVC 2 Beta?
Requesting Gravatar... san Nov 17, 2009 5:29 PM
# re: ASP.NET MVC 2 Beta Released
Can this be installed on windowsxp?
Requesting Gravatar... Mahesh Velaga Nov 17, 2009 6:54 PM
# re: ASP.NET MVC 2 Beta Released
Hi Phil,
This is not exactly related to this post, I just wanted to mention that, it would be good if every post also has the date time tag with it .. so that we can know when a particular post is posted.

I was going through all the stuff in your blog and thats what I felt.

Thanks
Requesting Gravatar... Edoardo Nov 17, 2009 6:59 PM
# re: ASP.NET MVC 2 Beta Released
Phil,

it is unclear whether ASP.NET MVC Beta 2 will be ever supported in VS2010 Beta 2 or not.
Can you answer this question?

Thanks
Requesting Gravatar... Mahesh Velaga Nov 17, 2009 7:00 PM
# re: ASP.NET MVC 2 Beta Released
Just that they are not showing up on the preview/overview posts, but showing upon when you click on the post
Requesting Gravatar... alberto Nov 17, 2009 8:45 PM
# re: ASP.NET MVC 2 Beta Released
Phil,
Do you plan to add support for hyphenated controllers and actions? They are very important for SEO. Having that integrated into the framework (routing, links to actions, etc) would really easy things on us.
Requesting Gravatar... Kieron Lanning Nov 17, 2009 9:51 PM
# re: ASP.NET MVC 2 Beta Released
Phil, I do think it's unjust that the early adopter, that do so much for the community by trying beta/ ctp software, have once again been left out in the cold. I'm of course referring to the lack of support for VS2010 - for every comment left on your blog about the the lack of support, you must assume that there are hundreds/ thousands more who haven't replied that have the same issues.

Is there nothing us VS2010'ers can do to get the beta playing nicely?? ...even an unofficial nudge in the right direction...
Requesting Gravatar... Dody Gunawinata Nov 17, 2009 10:27 PM
# re: ASP.NET MVC 2 Beta Released
Bummer. I have moved exclusively to use Visual Studio 2010 Beta 2. I'll stick with Preview 2 until the current Beta 2 code is available.
Requesting Gravatar... Bikal Gurung Nov 17, 2009 10:58 PM
# re: ASP.NET MVC 2 Beta Released
Is there any difference between the MVC 2 preview 2 release? functionality wise ?
Requesting Gravatar... Bikal Gurung Nov 17, 2009 11:08 PM
# re: ASP.NET MVC 2 Beta Released
Just a note. Realised you need to uninstall the MVC 2 prior releases to install this beta.
Requesting Gravatar... Hm Nov 17, 2009 11:09 PM
# re: ASP.NET MVC 2 Beta Released
Please provide a release for VS 2010 Beta 2!
Requesting Gravatar... Haacked Nov 18, 2009 12:40 AM
# re: ASP.NET MVC 2 Beta Released
To all who asked about VS10 Beta 2 and ASP.NET MVC 2 Beta, I know it's frustrating for those on VS10 Beta 2 who want to try out the ASP.NET MVC 2 Beta, and I'm sorry for that.

The tricky part in all this is that we're trying to hit two different ship trains. Unfortunately, I don't have any control over the VS10 ship schedule, so I can't force them to ship when we ship.

Since ASP.NET MVC 2 for VS10 is actually part of VS10, we really didn't want to get in the business of trying to ship parts of VS10 outside of the VS10 schedule. I'm not sure the VS10 team would be happy about that given it could interfere with evaluations of VS10 if we bork the installation.

The other option is to simply not ship previews of ASP.NET MVC 2 and wait for each VS10 release for people to get a taste. Obviously that's not the answer, so we didn't do that.

If you want to run ASP.NET MVC 2 on VS2008 side by side with VS2010, there is an unsupported at your own risk don't cry to us solution.

In Add/Remove programs uninstall the ASP.NET MVC 2 Tools for Visual Studio 2008 and then uninstall the ASP.NET MVC 2 runtime. It's the option that says simply "Microsoft ASP.NET MVC 2".

After that, install ASP.NET MVC 2 Beta. This will put the ASP.NET MVC 2 tools in VS10 in a state where they are not in sync with the runtime. We haven't tested this configuration a whole lot so it could also interfere with your ability to uninstall VS10 Beta 2, though I'm not sure if it will or not.

Again, we do appreciate you trying out pre-release software as your feedback is very helpful. I hope you are willing to accomodate the pains that often go hand in hand with pre-release software.

The situation will be fully resolved by RTM.
Requesting Gravatar... Green Williams Nov 18, 2009 12:57 AM
# re: ASP.NET MVC 2 Beta Released
Wake me up; on this MVC thing when version 3 comes out!
Requesting Gravatar... gerry lowry Nov 18, 2009 1:41 AM
# re: ASP.NET MVC 2 Beta Released
"running ASP.NET MVC 2 Beta on VS10 Beta 2 is not supported".

@ Phil ... I think you need to post disclaimer above also at:

http://forums.asp.net/t/1494009.aspx

I downloaded MVC 2 Beta specifically to use with VS10 Beta 2.

Thnx / Gerry
Requesting Gravatar... Yitzhak Nov 18, 2009 2:54 AM
# Migration from MVC 2 Preview 2 with multi-project areas to MVC 2 Beta
We currently have a VS2008 solution with multi-project areas. It was developed using the MVC 2 Preview 2. We are planning to migrate that solution to the recently released MVC 2 Beta.

ASP.NET MVC 2 Beta Release Notes document states the following:
• The build task for multi-project areas has been removed and placed in the ASP.NET MVC Futures project.

It sounds like that the support for multi-project areas was dropped in favor of single project with multiple areas organized as sub-folders on the file system.

The question is what is the recommended migration path to the MVC 2 Beta in our scenario?

Regards,
Yitzhak
Requesting Gravatar... AndyM Nov 18, 2009 5:06 AM
# re: ASP.NET MVC 2 Beta Released
First, I want to share my appreciation for the great work you guys are doing on ASP.NET MVC. I'm having problems with the Multi Area - Multi project change as well. I downloaded the Beta2 futures module, but am still getting build errors when the "CreateAreaManifest" build task is reached in web.config (Can not load Microsoft.Web.Mvc.Build). Any tips on how to get this working?
Requesting Gravatar... Soe Tun Nov 18, 2009 7:09 AM
# re: ASP.NET MVC 2 Beta Released
Client-side validation is "broken". In Preview 2, javascript function EnableClientValidation() is defined in MicrosoftMvcJQueryValidation.js file.


However, in MVC2 Beta version, MicrosoftMvcAjax.js file does not define the function.
Because of it, I'm getting JavaScript error dialog window and had to add it on my own.
Requesting Gravatar... Chris Nov 18, 2009 12:06 PM
# re: ASP.NET MVC 2 Beta Released

@Soe, It seems the MSI install doesn't include MicrosoftMvcJQueryValidation.js, I had to grab it from the source code download.

@Phil, In regards to the "Areas", the right click "Add Area" command is super awesome - only problem I had was that I immediately ran into the "The controller name 'Home' is ambiguous between the following types" when I made the second home controller.

I knew the solution (add the namespace parameter to the route configs in case anybody else is wondering), but I'm just wondering if there is any plan to have the automatically generated "RegisterRoutes" templates include the namespace parameter by default? This might just make it a more usable feature for people just getting started.

Requesting Gravatar... Trevor de Koekkoek Nov 18, 2009 8:44 PM
# re: ASP.NET MVC 2 Beta Released
My site uses $.getJSON() which returns a json array. There is no equivalent $post version of this that I'm aware of. So as a result my site couldn't work without setting JsonRequestBehavior.AllowGet which means my code is still vulnerable. Are there any suggestions as to how to handle this?
Requesting Gravatar... Soe Tun Nov 19, 2009 2:27 AM
# re: ASP.NET MVC 2 Beta Released
@Chris I got the MicrosoftMvcJQueryValidation.js from the source. The generated client-side validation function name used to be EnableClientValidation(validationContext, userState).
But, now it defaults to "Sys.Mvc.FormValidation.enableClientValidation" now as you can see in the System.Web.Mvc.FormContext class.


Looks like we have to manually set the "ClientValidationFuntion" name inside the Html.BeginForm() block like this.

<% using(Html.BeginForm()) { %>
<% this.ViewContext.FormContext.ClientValidationFunction = "EnableClientValidation"; %>

...

<% } // using BeginForm() block ends %>
Requesting Gravatar... I have some custom ModelBinder Nov 19, 2009 5:24 AM
# re: ASP.NET MVC 2 Beta Released
I have a project with some custom modelbinders. It was really cool to add support for instance dictionary binding:
[ModelBinder(typeof(DictionaryBinder<Guid,int>))]Dictionary<Guid,int> model
However, it seems that there is a new weird kind of interface for the valueprovider:
bool ContainsPrefix(System.Web.Mvc.ControllerContext, string)
ValueProviderResult GetValue(System.Web.Mvc.ControllerContext, string)
Why the tight coupling to ControllerContext? Why does the ValueProvider need to know about the controllercontext?
Best Regards from M
Requesting Gravatar... Felipe Lima Nov 19, 2009 9:12 AM
# re: ASP.NET MVC 2 Beta Released
I'm also confused as to what is the way go regarding Area support. I'm having the same problem as @Yitzhak, It would be good to know if the multi-project support for area registration is/will be dropped.
BTW, the Add area dialog is great.
Thanks Phil and all the MVC team for the great work! Really appreciated.

Felipe
Requesting Gravatar... Yitzhak Nov 19, 2009 10:55 AM
# Migration from MVC 2 Preview 2 with multi-project areas to MVC 2 Beta
Hi Phil,

I asked the same question, regarding the multi-project Areas support, on the ASP.NET MVC forum:
forums.asp.net/p/1494640/3520813.aspx#3520813

Up to this moment there is not a single reply on it.

This question is very important to answer for the entire community of supporters of the Microsoft ASP.NET MVC technology stack. Felipe Lima and I, like many others, are worried that there is no clear guidance from the ASP.NET MVC team regarding the multi-project Areas support in the ASP.NET MVC 2 version. This is a strategic infrastructure level question. You, being in capacity of the captain of the product, i.e. Senior Program Manager on the MVC team, would be the best person to provide the guidance and answer the question.

Regards,
Yitzhak
Requesting Gravatar... Kiran Nov 21, 2009 2:24 AM
# re: ASP.NET MVC 2 Beta Released
Is there any guidance in using AdditionalValues dictionary in ModelMetadata class? How this dictionary gets populated?
Requesting Gravatar... Chris Pietschmann Nov 21, 2009 5:08 AM
# re: ASP.NET MVC 2 Beta Released
I think not "officially" supporting ASP.NET MVC 2 Beta with VS'2010 isn't very smart. A lot of us are working with ASP.NET MVC 2 with VS'2010 and you are essentially abandoning us. Especially when you could just ship a new version of the "ASP.NET MVC 2 Visual Studio 2010 Tools" with the ASP.NET MVC 2 Beta just as you are shipping "ASP.NET MVC 2 Visual Studio 2008 Tools". C'mon guys this just looks lazy from my perspective, especially since both VS'2010 and ASP.NET MVC 2 Beta have Go Live licenses and are both supported separately.
Requesting Gravatar... Kieron Lanning Nov 22, 2009 6:48 AM
# re: ASP.NET MVC 2 Beta Released
@chris - Completely agree, I'm not going to chuck my toys in the corner and cry too much, but as you say, I do feel a little abandoned, especially as it should be just a tooling problems - the core assembly is probably the same.

Has anyone tried simply referencing the beta from with VS2010?
Requesting Gravatar... Haacked Nov 22, 2009 2:57 PM
# re: ASP.NET MVC 2 Beta Released
@Kieron yes, you can simply reference the beta from VS10. The MVC Tooling experience will be out of sync with the runtime, but most of it would work just fine.
Requesting Gravatar... Kieron Lanning Nov 22, 2009 4:33 PM
# re: ASP.NET MVC 2 Beta Released
@Phil - Hey, that's good news. We can always build everything else manually - nowt wrong with a little manual labour now and again.

Thanks!
Kieron
Requesting Gravatar... Deep Nov 23, 2009 8:15 PM
# re: ASP.NET MVC 2 Beta Released
Dear Phil,

Need your advice. We are starting a new project on .net and like to use the MVC. Shall we use the MVC 1 or can go for MVC 2 Beta and later upgrade to final release.

Also shall we use VS2008 or VS2010 Beta 2?

Thanx for your time.

Regards,
Deep
Requesting Gravatar... Lance Fisher Nov 24, 2009 1:49 PM
# re: ASP.NET MVC 2 Beta Released
Now I'm so torn whether to use VS 2010 w/MVC 2 Preview 2, VS 2008 2/MVC 2 Beta, or something unsupported and dangerous...

Thanks for all your hard work on this, but it is frustrating since I like shiny new things and they don't work together.
Requesting Gravatar... Haacked Nov 24, 2009 3:27 PM
# re: ASP.NET MVC 2 Beta Released
You can use VS10 with ASP.NET MVC 2 Beta if you simply reference the beta assembly as just another bin dependency. That's supported just fine. However, the tooling for VS10 will be out of sync, as it thinks you have the Preview 2 runtime.

I should have been more clear, running the ASP.NET MVC 2 Beta installer is not supported on a machine with VS2010. However, you can grab a copy of the beta MVC 2 dll and reference it in a VS10 project, but the experience won't be as nice.
Requesting Gravatar... Haacked Nov 24, 2009 3:42 PM
# re: ASP.NET MVC 2 Beta Released
@Deep That's a hard question to answer without knowing more about your environment. Are you able to respond to a changing framework? Or is stability a requirement? We may still make a few changes to ASP.NET MVC 2, but we won't be changing ASP.NET MVC 1.0.
Requesting Gravatar... kmehta Nov 25, 2009 2:54 AM
# re: ASP.NET MVC 2 Beta Released
Just upgraded from Beta2P2 to Beta2. Everything worked great (almost). I'm referencing the futures dll (Microsoft.Web.Mvc) as well as System.Web.Mvc.Html from my web config. I unfortunately need/want both namespaces for some things I'm doing.

Unfortunately some of my methods (ValidationMessageFor, TextBoxFor ...) are throwing an "Ambiguous Invocation" error. After the Beta2 release, it appears that some extension methods are duplicated in the core and futures libraries.

Phil, do you suggest a way around this, or is there a new version of the futures dll being released soon with these duplicates removed?

Appreciate the help.
Requesting Gravatar... AlanM Nov 25, 2009 1:25 PM
# re: ASP.NET MVC 2 Beta Released
@Phil - regarding VS10b2 and MVCb2, when you say "the tooling for VS10 will be out of sync, as it thinks you have the Preview 2 runtime.", can you please elaborate on what tooling will be out of sync so we know what the pain points will be? I'm guessing/hopeful it will actually not be that significant to most mvc developers.
Requesting Gravatar... dpfresh Dec 14, 2009 1:31 AM
# re: ASP.NET MVC 2 Beta Released
Phil, any word on a server install for the beta? Obviously this would be for a test server at this point but mvc 1 offered a command line server install option...

Much thanks.
Requesting Gravatar... BuzzBox Dec 16, 2009 1:22 AM
# re: ASP.NET MVC 2 Beta Released
I'll sign up for the same questio for @Phil - regarding VS10b2 and MVCb2, when you say "the tooling for VS10 will be out of sync, as it thinks you have the Preview 2 runtime.", can you please elaborate on what tooling will be out of sync so we know what the pain points will be? I'm guessing/hopeful it will actually not be that significant to most mvc developers.
Requesting Gravatar... Hemant Sathe Dec 19, 2009 9:07 AM
# re: ASP.NET MVC 2 Beta Released
Hi,
I had a working project where I was puling values from the Form using FormCollection and then using TryUpdateModel(itemToEdit, collection.ToValueProvider()). Since the upgrade, this call was failing giving error that "name" parameter cannot be null. I first thought it is error in my code. But there was none. I then downloaded source code and started debugging. I found that the DefaultModelBinder.BindModel method on Line 143 in System.Web.MVC, expects a ModelName. This value is set as the prefix provided by TryUpdateModel, which in my case was null. This is throwing the exception. However, if I change my code to receive the form values as the item type instead of collection, the code is working OK. Does this mean that using the value providers is reserved only for custom value providers with a specific value provided for ModelName?

Thanks
Requesting Gravatar... OutOfTouch Jan 15, 2010 3:01 AM
# re: ASP.NET MVC 2 Beta Released
When will ASP.Net MVC stop being a beta or RC and be released with a Version of Visual Studio? 2010?

What do you have to say?

(will show your gravatar)
Please add 6 and 6 and type the answer here: