gpt4 book ai didi

c# - 寻找错误版本的 Newtonsoft.Json.dll 的程序集

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:37 29 4
gpt4 key购买 nike

我的项目正在使用 Newtonsoft.Json.dll。我已将 dll 添加为对我的项目的引用,我使用的是 8.0.2 版

我的电脑上一切正常,但是当我将所有东西连同 Newtonsoft.Json.dll 一起转移到新电脑时,出现错误

Could not load file or assembly 'Newtonsoft.Json‚ Version=4.0.3.0‚ Culture=neutral‚ PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

我没有在任何地方引用那个版本,我的 app.config 中也没有指定这个版本。

最佳答案

前面的回答将帮助您找到问题所在。当某些引用的库明确指定它支持的库版本时,就会发生这种情况。幸运的是,您可以在 app.config 中覆盖绑定(bind)(参见下面的示例):

<configuration>
<!--YOUR CONFIG -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

关于c# - 寻找错误版本的 Newtonsoft.Json.dll 的程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40979337/

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