Could Not Load File or Assembly 'System.Web.Http 4.0.0 After Update from 2012 to 2013

Could not load file or assembly 'System.Web.Http, Version=4.0.0.0' after upgrading from vs2013 to vs2017

SOLVED: The problem was that when installing VS2017 you must check "ASP.NET and web development" in workloads in order for VS to recognize the project as Web project and use Web.config instead of app.config

Unfortunately if you miss this step there will be no useful error report, hope this helps someone thanks for the answers.

Could not load file or assembly System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

Follow the following steps:

  1. Update Visual Studio to to latest version (it matters)

  2. Remove all binding redirects from web.config

  3. Add this to the .csproj file:

    <PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
  4. Build the project

  5. In the bin folder there should be a (WebAppName).dll.config file

  6. It should have redirects in it, copy these to the web.config

  7. Remove the above snipped from the .csproj file

It should work.

Cannot load file or assembly with System.Web.Http, Version=4.0.0.0

Make sure to upload System.Web.Http.dll with your project. It usually ends up in the 'bin' folder after compiling.

Could not load file or assembly System.Net.Http, Version=4.0.0.0 with ASP.NET (MVC 4) Web API OData Prerelease

Visual Studio 2013 has a new feature to take care of this. When you build the app, you should see warnings about different versions of an assembly being referenced. Double click the warning to add assembly binding redirects to the web.config.

See http://msdn.microsoft.com/en-us/library/2fc472t2.aspx for more details.

jeff.eynon notes below that you need to have the web.config checked out (if using TFS source control) to get VS to edit the file automatically. Thanks for the tip!



Related Topics



Leave a reply



Submit