Newtonsoft.Json causes dependency warnings in UWP projects

Created on 15 May 2018  路  6Comments  路  Source: JamesNK/Newtonsoft.Json

Adding Newtonsoft.Json to a fresh UWP project causes dependency warnings:

runtime.native.System.IO.Compression 4.1.0 depends on runtime.win10-arm64.runtime.native.System.IO.Compression (>= 4.3.0) but runtime.win10-arm64.runtime.native.System.IO.Compression 4.3.0 was not found. An approximate best match of runtime.win10-arm64.runtime.native.System.IO.Compression 4.3.1 was resolved.

and

runtime.native.System.IO.Compression 4.3.0 depends on runtime.win10-arm64.runtime.native.System.IO.Compression (>= 4.3.0) but runtime.win10-arm64.runtime.native.System.IO.Compression 4.3.0 was not found. An approximate best match of runtime.win10-arm64.runtime.native.System.IO.Compression 4.3.1 was resolved.

Steps to reproduce

  • create a new UWP project (I chose target w10 1803, min version w10 CU, Microsoft.NETCore.UniversalWindowsPlatform 6.1.4)
  • install Newtonsoft.Json 11.0.2

Not sure I understand why and how Newtonsoft.Json depends on two versions of the same library. Maybe some transitive deps are running wild?

Most helpful comment

The problem is in UWP apps targeting MinVersion 10.0.15063 or older SDK version. Netstandard2.0 is only supported in UWP apps with MinVersion 10.0.16299 or newer.
For some reason starting with Newtonsoft.Json 10 Visual Studio/Nuget uses the ".NETStandard1.3" package in those apps instead of the previously used "portable-net45+wp80+win8+wpa81" package.

The .NETStandard1.3 target loads lots of Nuget dependencies from the NETStandard.Library 1.6.1 Nuget - this Nuget is completely unnecessary in UWP apps with MinVersion 10.0.15063 or older, see my previous issue #1291.

It might be a good idea to add new target ".NETCore5.0" to Newtonsoft.Json for UWP apps targeting older SDKs, without need to load full NETStandard.Library 1.6.1.
See here the Framework Precedence for UWP apps.

All 6 comments

Newtonsoft.Json 11 has a netstandard2.0 target. If you setup your UWP project to be able to use netstandard2.0 targets then either you shouldn't get any warnings about different package version.

If you do get warnings then it is a bug in UWP and you'll need to raise an issue with the UWP team.

Targeting netstandard2.0 is impossible because W10 mobile does not support anything beyond 1.4.

@JamesNK could you reopen this? As I said, there is no way for uwp devs to target netstandard2.0 if they want to ship their app to w10 mobile.

You'll have to live with warnings.

This is a .net library, not for UWP.

The problem is in UWP apps targeting MinVersion 10.0.15063 or older SDK version. Netstandard2.0 is only supported in UWP apps with MinVersion 10.0.16299 or newer.
For some reason starting with Newtonsoft.Json 10 Visual Studio/Nuget uses the ".NETStandard1.3" package in those apps instead of the previously used "portable-net45+wp80+win8+wpa81" package.

The .NETStandard1.3 target loads lots of Nuget dependencies from the NETStandard.Library 1.6.1 Nuget - this Nuget is completely unnecessary in UWP apps with MinVersion 10.0.15063 or older, see my previous issue #1291.

It might be a good idea to add new target ".NETCore5.0" to Newtonsoft.Json for UWP apps targeting older SDKs, without need to load full NETStandard.Library 1.6.1.
See here the Framework Precedence for UWP apps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Phreak87 picture Phreak87  路  11Comments

TylerBrinkley picture TylerBrinkley  路  37Comments

svick picture svick  路  34Comments

bytenik picture bytenik  路  11Comments

danebou picture danebou  路  18Comments