Nancy.Serialization.JsonNet icon indicating copy to clipboard operation
Nancy.Serialization.JsonNet copied to clipboard

Nancy.Serialization.JsonNet 0.22.2 for .NET 4.0 has a dependency on a .NET 4.5 JSON.NET dll

Open StefanBilliet opened this issue 11 years ago • 0 comments

Hi

I have a .NET 4.0 web api project with NancyFX and your serialization plugin. This project stops building as soon as I reference the JsonNetSerializer class directly with the error: Composition\Bootstrapper.cs(5,13): error CS0234: The type or namespace name 'Serialization' does not exist in the namespace 'Nancy' (are you missing an assembly reference?)

Further investigation in our build.log file yields this warning: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3275: The primary reference "Nancy.Serialization.JsonNet" could not be resolved because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

I checked the .dll in your NuGet package with DotPeek and even though it clearly states it's a .NET 4.0 dll, if I download your master.zip, swap out the JSON.NET reference to one with version 6.0.2 (also .NET 4.0), repack your package and use that one, everything works again.

If I replicate the project as a .NET 4.5 project, everything also works.

Thanks in advance for the help.

StefanBilliet avatar Apr 16 '14 06:04 StefanBilliet