我将 Odata v4 包 添加到我的 API 中,我注意到它将我的 Microsoft.AspNet.WebApi 包更新到 5.2.3版本。但是当我尝试使用
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));
我在我的项目中搜索了这个版本 (5.2.2),但所有东西都是 5.2.3,我也更新了所有包以解决这个问题但失败了。
复制到本地属性对于 System.Web.Http dll 也适用。
有什么想法吗?
最佳答案
Visual Studio 帮我解决了这个问题。版本冲突显示为警告,当我单击它时,它会自动将绑定(bind)重定向添加到我的 Web 配置中。
https://msdn.microsoft.com/en-us/library/2fc472t2.aspx
解决我的问题的绑定(bind)重定向是,
<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>
关于c# - 无法加载文件或程序集 'System.Web.Http,版本 = 5.2.2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31207110/