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:
- Removing MVC 4 libraries
- Upgrading MVC to a newer version
- Updating the Kentico MVC library
- Updating the Views web.config file
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.
- Open your Kentico application (WebApp.sln) in Visual Studio.
- We recommend using Visual Studio 2013 with Update 1 or newer.
- In Solution Explorer, remove all the files from the Lib/MVC/ folder.
- 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.
- Right click on the CMSApp_MVC project.
- Select the Manage NuGet Packages… option.
- Search for ’MVC’.
- Install the Microsoft ASP.NET MVC package.
Once the package installs, continue by Updating the Kentico MVC library.
Updating the Kentico MVC library
Download the Kentico MVC Upgrade from the Marketplace.
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.
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
In the CMSApp_MVC project, open the web.config file located in the Views folder.
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>
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" />
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>
Save the web.config file.