Upgrading the MVC version

Kentico 8.2 comes with MVC 4 included in the installation.

Note that MVC 5 requires .NET Framework 4.5 / 4.5.1.

The process of upgrading to a newer version of MVC consists of the following steps:

Backup your project before proceeding. This procedure requires you to make changes to the libraries in the project and web.config files.

Removing MVC 4 libraries

You only need to perform this scenario if your solution contains the Lib/MVC folder.

  1. Open your Kentico application (WebApp.sln) in Visual Studio.
    1. We recommend using Visual Studio 2013 with Update 1 or newer.
  2. In Solution Explorer, remove all the files from the Lib/MVC/ folder.
  3. In the file system, remove all the files from the Lib/MVC/ folder.

Upgrading MVC to a newer version

Now that you removed the libraries of the older MVC version, you need to get the new version of MVC libraries.

  1. Right click on the CMSApp_MVC project.
  2. Select the Manage NuGet Packages… option.
  3. Search for MVC’.
  4. Install the Microsoft ASP.NET MVC package.

Once the package installs, continue by Updating the Kentico MVC library.

Updating the Kentico MVC library

  1. Download the Kentico MVC Upgrade from the Marketplace.

  2. Unzip the package and expand the folder for the correct MVC version.

    • See your current MVC version by right-clicking References -> System.Web.Mvc in the CMSApp_MVC project and selecting Properties.
  3. Copy the CMS.MVC<version>.Impl.dll file to the Lib/MVC folder. You may need to create the folder if it’s not present.

Updating the Views web.config file

  1. In the CMSApp_MVC project, open the web.config file located in the Views folder.

  2. Update all elements that contain *S**ystem.Web.WebPages.Razor* from version “2.0.0.0” to a newer version.

    Updating System.Web.WebPages.Razor to a newer version
    
    
    
     <configSections>
         <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
             <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
             <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
         </sectionGroup>
     </configSections>
    
    
     
  3. Update the element that contains “System.Web.Mvc.MvcWebRazorHostFactory” from version 4.0.0.0 to the new version of your System.Web.Mvc library.

    Updating System.Web.Mvc.MvcWebRazorHostFactory to a newer version
    
    
    
     <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    
    
     
  4. In the <pages> section, update the System.Web.Mvc* elements to the new version of your System.Web.Mvc library. If you don’t plan on using the WebForm view engine, remove the section instead.

    Updating System.Web.Mvc* to a newer version
    
    
    
     <pages
         validateRequest="false"
         pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
         pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
         userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
         <controls>
             <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
         </controls>
         ...
     </pages>
    
    
     
  5. Save the web.config file.