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:
Update Visual Studio to to latest version (it matters)
Remove all binding redirects from
web.config
Add this to the
.csproj
file:<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>Build the project
In the
bin
folder there should be a(WebAppName).dll.config
fileIt should have redirects in it, copy these to the
web.config
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
Sending Windows Key Using Sendkeys
How to Force My C# Winforms Program Run as Administrator on Any Computer
C# Wait for User to Finish Typing in a Text Box
How to Optionally Turn Off the JSONignore Attribute at Runtime
Right Way to Dispose Image/Bitmap and Picturebox
Get the Default Timezone for a Country (Via Cultureinfo)
Hangfire - Multi Tenant, ASP.NET Core - Resolving the Correct Tenant
How to Include Other Files to the Output Directory in C# Upon Build
How to Retrieve Disk Information in C#
Can the Oracle Managed Driver Use Async/Await Properly
Parent Control Mouse Enter/Leave Events with Child Controls
How to Read/Stream a File Without Loading the Entire File into Memory
How to Embed Multiple Images in Email Body Using .Net