1
votes

We have a project that is utilizing a set of Nuget-based Azure libraries. One of them was published with a specific MIN and MAX dependency on Newtonsoft.Json (max version being 7)

This was a headache, because other libraries depend on 8+ version of Netwon and this specific Azure library is just fine working with any modern Json package.

In VS2013, we forced to install this Azure library with newer version of Json package thru nuget installer and subsequently, Nuget never gave us any issues installing/updating other libraries.

However, after upgrading to VS2017, we cannot update any package (or at least the ones that depend on Json) and we get the error below.

Unable to resolve dependencies. 'Newtonsoft.Json 8.0.3' is not compatible with 'Microsoft.Azure.Insights 0.15.0-preview constraint: Newtonsoft.Json (>= 6.0.8 && < 7.0.0)'

How do we have Nuget ignore that specific Azure library's unimportant MAX version dependence?

1

1 Answers

4
votes

How do we have Nuget ignore that specific Azure library's unimportant MAX version dependence?

If you confirm that Azure library is just fine working with any modern Json package and you want use the Microsoft.Azure.Insights 0.15.0-preview and 8+ version of Newtonsoft.Json at the same time. I would like provide a workaround to you, hope this can help you.

Detailed Steps:

  1. Install the package Microsoft.Azure.Insights 0.15.0-preview with its dependencies first.

  2. Only uninstall the package Microsoft.Azure.Insights 0.15.0-preview, Keep dependencies installed.

  3. Update the Newtonsoft.Json to the version 8+.

  4. Install the package Microsoft.Azure.Insights 0.15.0-preview in the Package Manager Console with following NuGet command:

Install-package Microsoft.Azure.Insights -IncludePrerelease -IgnoreDependencies

With the option -IgnoreDependencies, NuGet will ignore that specific Azure library's unimportant MAX version dependence:

enter image description here

Note: Need to mention is that if you update the Newtonsoft.Json package next time, you still need to follow the steps above to upgrade your Newtonsoft.Json package.