Can I run a MVC 1 application using the MVC 2 assemblies without a hitch? I understand that some 3rd party tools have had stuff broken in MVC 2, but let’s assume I’m not using those any other tools.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There have been breaking changes.
If you want a 1.0 project to run on 2.0, it does look for things in different places; so you’d have to migrate the application to 2.0..
Here are the changes that could possibly ‘break’ (current as of Preview 2):
Changes in Preview 2
Helpers now return an
MvcHtmlStringobjectIn order to take advantage of the new HTML-encoding expression syntax in ASP.NET 4, the return type of the HTML helpers is now
MvcHtmlStringinstead of astring. Note that if you use ASP.NET MVC 2 and the new helpers with ASP.NET 3.5, you will not be able to take advantage of the HTML-encoding syntax; the new syntax is available only when you run ASP.NET MVC 2 on ASP.NET 4.JsonResultnow responds only to HTTP POST requestsIn order to mitigate JSON hijacking attacks that have the potential for information disclosure, by default, the
JsonResultclass now responds only to HTTPPOSTrequests. AJAX GET calls to action methods that return aJsonResultobject should be changed to use POST instead. If necessary, you can override this behavior by setting the newJsonRequestBehaviorproperty ofJsonResult. For more information about the potential exploit, see the blog post JSON Hijacking on Phil Haack’s blog.Model and ModelType property setters on
ModelBindingContextare obsoleteA new settable
ModelMetadataproperty has been added to theModelBindingContextclass. The new property encapsulates both the Model and theModelTypeproperties. Although theModelandModelTypeproperties are obsolete, for backward compatibility the property getters still work; they delegate to theModelMetadataproperty to retrieve the value.Changes in Preview 1
DefaultControllerFactoryclass changes break custom controller factories that derive from itThis change affects custom controller factories that derive from
DefaultControllerFactory. The DefaultControllerFactory class was fixed by removing theRequestContextproperty and instead passing the request context instance to the protected virtual methodsGetControllerInstanceandGetControllerType.Custom controller factories are often used to provide dependency injection for ASP.NET MVC applications.
To update the custom controller factories to support ASP.NET MVC 2, change the method signature or signatures to match the new signatures, and use the request context parameter instead of the property.
“Area” is a now a reserved route-value key
The string “area” in Route values now has special meaning in ASP.NET MVC, in the same way that “controller” and “action” do. One implication is that if HTML helpers are supplied with a route-value dictionary containing “area”, the helpers will no longer append “area” in the query string.
If you are using the Areas feature, make sure to not use
{area}as part of your route URL.Known Issues
The Add View dialog box throws a NullReferenceException when the Create strongly-typed view check box is checked, a View Content selection other than “Empty” is selected, and a View data class type name is specified for a type that does exist. When specifying a type name, either use the drop-down list to select the type name or type the fully-qualified type name. For types that do not exist, you must set View Content to “Empty”.