I added the Odata v4 package to my API, I noticed that it updated my Microsoft.AspNet.WebApi package to 5.2.3 version. But when i try to use
odata builder configuation in my WebApiConfig it showing error like 'Could not load file or assembly 'System.Web.Http, Version=5.2.2.0'.
config.MapODataServiceRoute("odata", null, GetEdmModel(), new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
I searched this version(5.2.2) in my project but every thing is 5.2.3 and I updated all the packages too to solve this issue but failed.
Copy to Local property also true for System.Web.Http dll.
Any idea?
Visual studio solved this for me. The version conflicts are shown as warning and when I clicked it automatically added the binding redirect to my web config.
https://msdn.microsoft.com/en-us/library/2fc472t2.aspx
The binding redirect that solved my issue is,
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With