始终使用 Newtonsoft.Json 的最新版本
Always use latest version of Newtonsoft.Json
我有一个 .NET 项目引用了依赖于 Newtonsoft.Json 版本 6.0.8 的 nuget。核心是 https://www.nuget.org/packages/Microsoft.Azure.KeyVault/3.0.2
我想在我的项目中只使用最新版本的 Newtonsoft,所以我希望这个项目实际使用 12.0 版的 Newtonsoft。我不确定这是否可能。我尝试将 app.config 文件添加到我的项目中,但这没有用。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.1.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
有什么办法可以实现吗?
我通过使项目明确引用最新版本的 Newtonsoft 解决了这个问题。似乎一切正常。
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
我有一个 .NET 项目引用了依赖于 Newtonsoft.Json 版本 6.0.8 的 nuget。核心是 https://www.nuget.org/packages/Microsoft.Azure.KeyVault/3.0.2
我想在我的项目中只使用最新版本的 Newtonsoft,所以我希望这个项目实际使用 12.0 版的 Newtonsoft。我不确定这是否可能。我尝试将 app.config 文件添加到我的项目中,但这没有用。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.1.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
有什么办法可以实现吗?
我通过使项目明确引用最新版本的 Newtonsoft 解决了这个问题。似乎一切正常。
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />