gpt4 book ai didi

C# 程序集重定向

转载 作者:行者123 更新时间:2023-11-30 12:38:51 26 4
gpt4 key购买 nike

我正在使用 Oracle.DataAccess,并且需要访问较旧的数据库,这意味着我需要使用该程序集的较旧版本。新旧程序集都在 GAC 中,但我似乎无法让应用程序使用旧版本。这是我的 .config 文件:

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>
<bindingRedirect oldVersion="2.121.1.0" newVersion="2.112.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

fuslogvw 什么也没显示(就像什么都没有,完全是空的),但我不太熟悉这个工具,所以也许我用错了(也)。

有什么想法吗?

最佳答案

您的配置文件看起来正确。但我会把旧版本改成这个0.0.0.0-2.999.9.0。因为那时您并不真正关心 Oracle dll 的实际版本是什么,新版本就是您要使用的正确(旧)版本。

现在您确定这是正确的版本吗? Oracle.DataAccess 的第 2 版非常旧。

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>
<bindingRedirect oldVersion="0.0.0.0-2.999.9.0" newVersion="2.112.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

这是来自 MS 的更多信息 https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element

关于C# 程序集重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49232891/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com