title: visual studio 2012 RC Could not load type System.Web.Http.RouteParameter
body: <p>I had VS 11 Beta, .net 4.5 and MVC 4 beta installed on my PC. I just downloaded the latest RC and now I get this error message when I try to run web projects. I tried reinstalling .net 4.5 and uninstalling and resinstalling VS 12 RC but that hasn't worked. I tried the 
  suggestion <a href="http://www.christophdebaene.com/blog/2012/04/06/building-the-source-code-of-asp-net-web-api/" rel="nofollow">here</a> which didn't work either. </p>
  
  <p><strong>Stack</strong></p>
  
  <pre><code>Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.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.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  
  Source Error:
  
  
  Line 26:                 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  Line 27:             );
  Line 28:         }
  Line 29:     }
  Line 30: }
  
  
  Source File: c:\projects\testNew\testNew\App_Start\RouteConfig.cs    Line: 28
  
  Stack Trace:
  
  
  [TypeLoadException: Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
     testNew.RouteConfig.RegisterRoutes(RouteCollection routes) in c:\projects\testNew\testNew\App_Start\RouteConfig.cs:28
     testNew.MvcApplication.Application_Start() in c:\projects\testNew\testNew\Global.asax.cs:25
  
  [HttpException (0x80004005): Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9841101
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
     System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
     System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
  
  [HttpException (0x80004005): Could not load type 'System.Web.Http.RouteParameter' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
  
  
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626 
  </code></pre>
  
  <p><strong>Edit 6</strong></p>
  
  <p>I used <code>fuslogvw</code> and found out that the project was referencing the <code>System.Web.Http.dll</code> from here</p>
  
  <pre><code>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Http\v4.0_4.0.0.0__31bf3856ad364e35
  </code></pre>
  
  <p>instead of my project. Renaming this file made my project work but I obviously can't do this on my shared hosting site.</p>
  
  <p>I've manually referenced the dll from </p>
  
  <pre><code>C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies
  </code></pre>
  
  <p>and set it to <code>Copy to Local</code>. Still it loads from <code>gac_msil</code>. How do I override this?</p>