如何在库上设置运行时绑定重定向

问题描述 投票:2回答:1

我有一堆.net dll,由Delphi应用程序(通过COM)使用,我收到错误'无法加载newtonsoft.json 6.0.0.0版'

因为A.dll引用了newtonsoft.json 11.0.0.0,所以B.dll引用了HttpClient System.Net.Http.Formatting,它似乎引用了newtonsoft.json 6.0.0.0。并且所有dll都在一个文件夹中,只有11.0版本。

并且所有现有解决方案都添加了bindingRedirect,但它仅适用于Windows应用程序和Web应用程序。我试图将bindingredict添加到A.dll.config,B.dll.config,但这不起作用。

我该怎么做才能解决这个问题?

c# dll
1个回答
0
投票

你可以用这个:

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
© www.soinside.com 2019 - 2024. All rights reserved.