Posts

Showing posts with the label Asp.net MVC 5.0

Updating MVC4 to MVC5

In my last article on MVC, I updated Razor 2.0 to 3.0 and showed the difficulties of updating the Razor nuget package in a MVC application. This article picks up from there and since Razor 3.0 is dependent on MVC5 I can assume you have updated Razor already.

Typical errors you will see..
Method not found: 'System.Web.WebPages.IDisplayMode System.Web.Mvc.ControllerContext.get_DisplayMode()'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.MissingMethodException: Method not found: 'System.Web.WebPages.IDisplayMode System.Web.Mvc.ControllerContext.get_DisplayMode()'.
Updating the System.Web.WebPages to version 3.0 fixed this issue. However you may see more packages issues like it.

What you can do is try reinstall each package that appears to be broken like so..
Update-Package –reinstall <packageName…

Asp.net MVC4 - Bundling and Minification

While this article may be very simple and straightforward, there are a few concepts here I think are important to note. In my next article will be looking more in depth on the idea of creating a customized Web.config, but for now with this article, I just want to look at activating the bundling and minification feature by using the xml tags inside a MVC's Web.config. This feature is only available in ASP.NET 4.5 and above.
The First Problem
With the following inside your Web.config... (transform is with a Captial T.)
And with either of the following inside your build config or customized Web.config (I.E. Web.Release.config)
This also can be achieved by doing the following...
     In both snippets of code you do not need to use the "xdt:Locator" attribute (used only in cases where there are multiples elements of the same name .  What you may not see is that in the Web.config we have the "location" tag wrapped around the "system" tag. This is important …