3

enter image description here

See the screenshot, I have Newtonsoft.Json.dll whose version is 10.0. In Visual Studio, I add the DLL to references and I find in csproj, the full name is "Newtonsoft.Json, Version=6.0.0.0 ..." instead of "Newtonsoft.Json, Version=10.0.0.0".

Why is the version different from what I retrieve at runtime?

Gqqnbig
  • 5,845
  • 10
  • 45
  • 86
  • You have specific version = false. Check out this post about specific version and search order https://stackoverflow.com/questions/24022134/how-exactly-does-the-specific-version-property-of-an-assembly-reference-work-i – hawkstrider Aug 07 '18 at 19:32

2 Answers2

3

Assembly version and File version are two different versions.

JSON.NET does not update the assembly version (the one in your second screenshot) except for major releases to avoid issues with strong naming.

The package version and file version will be correct.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
  • How do I get the assembly version programmatically and in windows explorer? I use `t.Assembly.GetName().Version`, the return value is still 10 instead of 6. – Gqqnbig Aug 07 '18 at 20:36
  • Oh, never mind. When I set `specific version = true`, Visual Studio updates the strong name to 10.0. I'm wondering where the 6.0 comes from... maybe my GAC has 6.0 and Visual Studio so happens to find it first? – Gqqnbig Aug 07 '18 at 20:41
1

I read few years ago that Newtonsoft was stuck at v 6.0.0.0 due to strong naming. James Newton opted to not update version with new releases to not break existing clients since the assembly was strong named.

I am not sure if that restriction still applies.

Tanveer Badar
  • 5,438
  • 2
  • 27
  • 32