Upgrading ASP NET MVC 3 to ASP MVC 4

Recently, asp net mvc 4 has been released, and it happened that i wanted to convert my mvc 3 application to mvc 4.  The steps are really easy since all you need is to change the configuration files of the application

  1. To manually upgrade an existing ASP.NET MVC 3 application to version 4, do the following:
    1. In all Web.config files in the project (there is one in the root of the project, one in the Views folder, and one in the Views folder for each area in your project), replace every instance of the following text (note: System.Web.WebPages, Version= is not found in projects created with Visual Studio 2012):System.Web.Mvc, Version=
      System.Web.WebPages, Version=
      System.Web.Helpers, Version=
      System.Web.WebPages.Razor, Version=

      with the following corresponding text:

      System.Web.Mvc, Version=
      System.Web.WebPages, Version=
      System.Web.Helpers, Version=,
      System.Web.WebPages.Razor, Version=,

    2. In the root Web.config file, update the webPages:Version element to “” and add a newPreserveLoginUrl key that has the value “true”:<appSettings>
        <add key=”webpages:Version” value=”″ />
        <add key=”PreserveLoginUrl” value=”true” />
    3. In Solution Explorer, right-click on the References and select Manage NuGet Packages. Search for Microsoft.AspNet.Mvc and install the Microsoft ASP.NET MVC 4 package. Click OK.
    4. In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj.
    5. Locate the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}.
    6. Save the changes, close the project (.csproj) file you were editing, right-click the project, and then select Reload Project.
    7. If the project references any third-party libraries that are compiled using previous versions of ASP.NET MVC, open the root Web.config file and add the following three bindingRedirect elements under the configuration section:

        <!–… elements deleted for clarity …–>
          <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
              <assemblyIdentity name=”System.Web.Helpers” 
                   publicKeyToken=”31bf3856ad364e35″ />
              <bindingRedirect oldVersion=”″ newVersion=”″/>
              <assemblyIdentity name=”System.Web.Mvc” 
                   publicKeyToken=”31bf3856ad364e35″ />
              <bindingRedirect oldVersion=”″ newVersion=”″/>
              <assemblyIdentity name=”System.Web.WebPages” 
                   publicKeyToken=”31bf3856ad364e35″ />
              <bindingRedirect oldVersion=”″ newVersion=”″/>

Easy 🙂 You have you application on asp net mvc 4. Hope you enjoy!!



About Piusn

Enthusiastic Software Developer

What's your thought on the subject?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: