Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Problems Upgrading ASP.NET MVC to Preview 5

Expecting it to be painless to move from Preview 4 to Preview 5 was probably hoping a little too much ... but it certainly wasn't the worst thing in the world.

A couple of things did catch me that I didn't find in the notes for upgrade, so I thought I best post them in case someone else gets the same problems:

BindingHelperExtensions.UpdateFrom has gone

Yep, gone ... which was a bit of a pain. I understand many people are using other methods, and probably we should be too, but this was the simplest option and is now being used commonly here.  In it's place it turns out that you can use:

UpdateModel.From(model, Request.Form.AllKeys)

this.ReadFromRequest has gone

Another removal, the replacement is:

Request["key"]

LinkBuilder and BuildUrlFromExpression gone

Actually they haven't, but they have been moved to Microsoft.Web.Mvc ... so you probably need to change your references to the new assembly.

Multiple Entries for System.Web.Routing in web.config

I did a manual edit to change the assembly version from 0.0.0.0 to 3.5.0.0 and I missed a few - it seems there are 4 entries for this assembly in my web.config - so check you updated all of them ...

Update: Html.CheckBox("rememberMe", "Remember me?", "rememberMe", true) has changed!

Missed this one till one of the developers here tried to get the login page to work ... it looks like they changed the signature of this, and a few other Html.xxxx extensions ... a bit of a pain, we only have around 50 views at the moment, and unfortunately it isn't a simple find/replace ... oh well ...

Further Update: Html.ActionLink is just plain broken

Grrrr ... This is annoying ...  They went and changed the signatures on Html.ActionLink

This wouldn't be so bad, except that our previous line of:

Html.ActionLink("edit", "Edit", ViewData.Model.ControllerName, new { item.Id })

Doesn't work, and results in a link with ?Length=8 on the end of it. This appears to be because it is matching the wrong signature on the ActionLink overloads, and now matches "string controllerName" as object instead.

Fixing it is rather "yuk" ... force it to use the right overload with:

Html.ActionLink("edit", "Edit", ViewData.Model.ControllerName, new { item.Id }, null)

 

 


Posted 09-02-2008 1:16 PM by Jak Charlton
Filed under: ,

[Advertisement]

Comments

Chris Canal wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 09-02-2008 8:44 AM

I'm upgrading tonight, cheers for heads up :0)

Corey wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 09-02-2008 10:47 AM

Scott Guthrie's mentions the changes in his latest blog post. Might make the migration a bit less painful.

Reflective Perspective - Chris Alcock » The Morning Brew #171 wrote Reflective Perspective - Chris Alcock » The Morning Brew #171
on 09-03-2008 3:05 AM

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #171

Colin Jack wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 09-03-2008 6:14 AM

"Yep, gone ... which was a bit of a pain. I understand many people are using other methods, and probably we should be too, but this was the simplest option and is now being used commonly here.  In it's place it turns out that you can use:

UpdateModel.From(model, Request.Form.AllKeys)"

Except when it then tries to bind the submit button, very annoying change.

ASP.NET MVC Archived Blog Posts, Page 1 wrote ASP.NET MVC Archived Blog Posts, Page 1
on 09-03-2008 10:05 AM

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

Tim Barcz wrote Upgrading to MVC Preview 5 - System.Web.Routing problem
on 09-22-2008 10:55 PM

Yeah this is old hat, I know.  The Preview 5 release was news about three weeks ago.  There

Community Blogs wrote Upgrading to MVC Preview 5 - System.Web.Routing problem
on 09-22-2008 11:33 PM

Yeah this is old hat, I know.  The Preview 5 release was news about three weeks ago.  There

sergiopereira wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 09-23-2008 9:13 AM

"Further Update: Html.ActionLink is just plain broken"

Yep, this was a nasty change (or accident)... The worst part is that it will probably be repaired before release, causing "the other half" of the cases (the ones using the sorter overload for html attributes) to break. Well, that's life with pre-release software.

John Brennan wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 10-01-2008 9:03 PM

Cheers Casey, Html.ActionLink was driving me nuts. I couldn't figure out why querystring was not rendering correctly. That error in the constructor overload was a sneaky one.

Thanks again,

John

Matt wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 11-10-2008 6:47 PM

Thanks :-)

Mason wrote re: Problems Upgrading ASP.NET MVC to Preview 5
on 11-19-2008 2:15 PM

The overload for HtmlActionLink was moved to the MvcFutures assembly. Just like it said in the installation readme.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)