title: Asp.Net Mvc 4 website deploying on server throwing error "Could not load type 'System.Web.WebPages.DisplayModes'"
body: <p>I am struggling with this issue from past 6 hours and still not able to figure this out. I was getting this exception when I deployed one of the Asp.Net Mvc 4 project on the server which is a shared hosting. I got this issue. </p>
  
  <p>I googgled and found that it could be an issue related with the version differences of System.Web.Mvc and System.Web.WebPages. I verified version number of all dlls, tried to re-install using nuget, but still got the same message.</p>
  
  <p>Thinking it could be an issue related with my project only, I created a new Asp.Net Mvc 4 Internet Application and deployed it on the server, boom... got the same message. </p>
  
  <p>I spent next few hours un-installing all older versions of Asp.Mvc, repairing  Visual Studio 2010, installing Mvc 4 again using Web Platform Installer, but nothing could help, still getting the same message. </p>
  
  <p>Can anybody please help, I am just stuck.</p>
  
  <p>Here is the error message</p>
  
  <pre><code>Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
  Exception Details: System.TypeLoadException: Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  
  Source Error: 
  
  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
  
  Stack Trace: 
  
  
  [TypeLoadException: Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
     System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]&amp; searchedLocations) +0
     System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache) +198
     System.Web.Mvc.&lt;&gt;c__DisplayClassc.&lt;FindView&gt;b__a(IViewEngine e) +43
     System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths) +177
     System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator) +23
     System.Web.Mvc.ViewResult.FindView(ControllerContext context) +144
     System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +151
     System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +33
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +846308
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
     System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +846608
     System.Web.Mvc.Controller.ExecuteCore() +159
     System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
     System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +62
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +20
     System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +54
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +375
  
     Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
  </code></pre>
  
  <p>Here are the link that I googled and found  to resolve the issue:</p>
  
  <p><a href="http://tkntips.blogspot.in/2012/05/could-not-load-type-systemwebwebpagesdi.html" rel="nofollow">http://tkntips.blogspot.in/2012/05/could-not-load-type-systemwebwebpagesdi.html</a></p>
  
  <p>Solution is not that clear. Did not work for me.</p>