André Reichelt
André Reichelt

Reputation: 1631

Microsoft WebAPI asks for System.Net.Http, Version=4.0.0.0

Since I've updated my project to .net 4.8, I constantly get runtime errors (FileNotFoundException):

Die Datei oder Assembly "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

The error is thrown by the following line:

WebApiConfig.Register(GlobalConfiguration.Configuration);

How can I fix that? I've already installed the latest System.Net.Http DLL version via NuGet and added a junction to the web.config:

<dependentAssembly>
  <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-4.3.4.0" newVersion="4.3.4.0" />
</dependentAssembly>

This all did not help at all.

Upvotes: 1

Views: 769

Answers (1)

Andr&#233; Reichelt
Andr&#233; Reichelt

Reputation: 1631

I found the solution in this answer. My web.config file was full of redirections of obligatory files. I found, that all my other projects based on the used template don't have those redirects. Therefore, I used the method described in the linked answer to fix it.

Upvotes: 1

Related Questions