Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在库上设置运行时绑定重定向_C#_Dll - Fatal编程技术网

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

C# 如何在库上设置运行时绑定重定向,c#,dll,C#,Dll,我有一堆由Delphi应用程序(通过COM)使用的.net DLL,我得到一个错误“无法加载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,但它只适用于wind

我有一堆由Delphi应用程序(通过COM)使用的.net DLL,我得到一个错误“无法加载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,但没有成功

我能做些什么来解决这个问题

您可以使用:

<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>

它适用于.net应用程序,但当DLL用作库时不起作用。