如何避免Nuget冲突参考?

发布于 2025-01-30 11:21:47 字数 134 浏览 2 评论 0 原文

我有一个参考Nuget Newtonsoft JSON版本11的项目A,并且还有另一个项目B,该项目引用了Nuget Newtonsoft JSON 13和项目B。有什么方法可以解决这个问题,或者唯一的方法是将newtonsoft Nuget更新为13?

I have a project A that references NuGet Newtonsoft Json version 11 and I have another project B that references NuGet Newtonsoft Json 13 and also project B. Since project B references a lesser version the NuGet addition throws an error in the Visual Studio. Is there any way to address this or the only way is to have Project A update the Newtonsoft nuget to 13?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二货你真萌 2025-02-06 11:21:47

您可以在相关项目配置文件中重定向组件。示例:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

在此处阅读有关重定向组件的更多信息:

You can redirect assembly in related project configuration file. Example:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Read more about Redirecting Assembly here: https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文