C# – Could not load file or assembly Microsoft.Win32.Primitives, Version=4.0.0.0

.net-assemblycfileloadexceptionvisual studioweb

I am having problems running my web application.

The project setup is ASP.NET Core web application (.NET Framework). I don't seem to get any Build error. The project doesn't just run.

System.IO.FileLoadException: 'Could not load file or assembly 'Microsoft.Win32.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

enter image description here

Best Answer

Try adding the System.Net.Http nuget package.