---
title: Upgrading the MVC version
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Kentico 8.2 comes with [MVC](https://docs.kentico.com/k82/developing-websites/developing-sites-using-the-mvc-framework.md) 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:

> **Note:** 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).

## Updating the Kentico MVC library

1. Download the [Kentico MVC Upgrade](http://devnet.kentico.com/marketplace/utilities/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.

   ```xml title="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.

   ```xml title="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.

   ```xml title="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.
