---
title: Upgrade from MVC 4 to 5
slug: cms-12/docs/upgrading-from-mvc-4-to-5
docTags: 
createdAt: 2026-08-10T15:56:04.000Z
---

Follow the steps below to upgrade your Optimizely Content Management System (CMS 8) project to the latest MVC version.

1. Upgrade your site to the latest NuGet package for [ASP.NET MVC](http://www.nuget.org/packages/Microsoft.AspNet.Mvc), run `Update-Package Microsoft.AspNet.Mvc` in the Package Manager Console.
2. Update the application `web.config` file in your project as follows:
   - Change the `System.Web.Mvc` version number from "4.0.0.0" to "5.0.0.0".
   - Change the `System.Web.Helpers` and `System.Web.WebPages` version number from "2.0.0.0" to "3.0.0.0" (if not already done). If `System.Web.WebPages.Razor` exist as a dependent assembly, it should also have version "3.0.0.0".
   - Change the `webpages:Version` in the `<appSettings>` section from 2.0.0.0.0 to 3.0.0.0.
     The result should look like:

```xml
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
              <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
              <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
              <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
              <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
            </dependentAssembly>
          </assemblyBinding>
        </runtime>
          
          <appSettings>
            <add key="webpages:Version" value="3.0.0.0" />
            <add key="webpages:Enabled" value="false" />
            <add key="PreserveLoginUrl" value="true" />
            <add key="ClientValidationEnabled" value="true" />
            <add key="UnobtrusiveJavaScriptEnabled" value="true" />
          </appSettings>
```

3. Update the `web.config` file in the `Views` folder as follows:
   - Update elements containing `System.Web.Mvc` from version "4.0.0.0" to "5.0.0.0".
   - Update elements containing `System.Web.WebPages.Razor` from version "2.0.0.0" to "3.0.0.0".

```xml
<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>
```

```javascript
  If this section contains `System.Web.WebPages`, update those elements from version "2.0.0.0" to "3.0.0.0".  
     
```

```xml
<configuration>
          <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>
```

4. If you use Web API 1, run "Install-Package Microsoft.AspNet.WebApi.WebHost" in the Package Manager Console to update your global.asax from:

```javascript
WebApiConfig.Register(GlobalConfiguration.Configuration);
```

to:

```javascript
GlobalConfiguration.Configure(WebApiConfig.Register);
```

5. Build your solution and verify that the site is working.

See also [How to upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2](http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2) (Microsoft)
