Installing ASP.NET MVC 4 Beta breaks ASP.NET MVC 3 RTM applications

We where just bitten by this one and the problem was not immediately obvious.

You will see some error like

The name ‘model’ does not exist in the current context

or

‘System.Web.WebPages.Html.HtmlHelper’ does not contain a definition for ‘ActionLink’ and no extension method ‘ActionLink’ accepting a first argument of type ‘System.Web.WebPages.Html.HtmlHelper’ could be found (are you missing a using directive or an assembly reference?)

 

image

 

Additionally when you check the IntelliSense of @Html you will not see some of the extension methods like Action() or ActionLink()

 

Fixing it is not hard one you know the problem.

Include the webpages:Version key with a value of 1.0.0.0 in the appSettings section of your web.config, fix the references for System.Web.WebPages and System.Web.Helpers and restart Visual Studio 2010 to fix the problem.

   1: <appSettings>


   2:   <add key="webpages:Version" value="1.0.0.0" />


   3:   <add key="ClientValidationEnabled" value="true" />


   4:   <add key="UnobtrusiveJavaScriptEnabled" value="true" />


   5: </appSettings>



 



See the Known Issues and Breaking Changes in the ASP.NET MVC 4 Release notes. And this only applies to projects created using ASP.NET MVC 3 RTM. The projects created by the ASP.NET MVC 3 Tools Update release are fine.



 



Enjoy!



 



[f1]
[f2]

One thought on “Installing ASP.NET MVC 4 Beta breaks ASP.NET MVC 3 RTM applications

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>