我在我的.NetFramework 4.6.2项目中引用了一个针对.NetStandard和.NetFramework的nuget包。作为依赖项,此nuget包安装了System.Runtime.InteropServices
包。但是现在,当我试图通过浏览器访问我的服务时,我得到了这个错误:Could not load file or assembly 'System.Runtime.InteropServices, 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)
花了3个多小时来尝试修复这个one.Anyone?
这就是我引用的nuget包:https://github.com/wavefrontHQ/wavefront-opentracing-sdk-csharp
下面是我的Web.config
的样子:
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
发布于 2019-04-01 15:12:34
您可以尝试删除下面的web.config条目。
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
编辑:一些用户确认这种方法是从Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation开始工作的
https://stackoverflow.com/questions/55449399
复制相似问题