I updated my application from .NET Framework 4.6.1 to 4.8 but I have an error loading the application.
For context: This application uses the Ninject Nuget for dependency injection. This nuget automatically creates a file called "NinjectWebCommon.cs" inside the App_Start folder
In this ninject file I am having an error with the StandardKernel(); method
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
The error I am having is this:
System.IO.FileNotFoundException: ‘Cannot load file or assembly
‘System.Net.Http, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The
system cannot find the file specified.’
Searching for a solution I found that I needed to have inside the Web.config a binding redirect, but I already have it.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0"/>
</dependentAssembly>
I also have on the project references System.Net.Http, so I don’t know what could it be
2
Answers
I deleted the dependentAssembly for System.Net.Http and it worked. I don't know if that is the optimal solution btw
I had a similar problem. This is what I did to resolve it, AFTER upgrading to 4.8.
Worked like a charm!