1

My custom class library (targeting .NET 4.5.1) references Newtonsoft.Json 8.0.2 (the latest version to date). I've added this class library as a reference to a new ASP.NET 5 Web API project.

From the Error List output:

Error NU1002 The dependency Newtonsoft.Json 1.0.0 in project MyProject does not support framework DNXCore,Version=v5.0.

That part seems somewhat self-explanatory, however, I couldn't understand why it was changing my referenced version to 1.0.0.

From the References --> DNX 4.5.1 --> MyClassLibrary Node:

NU1007 Dependency specified was Newtonsoft.Json >= 8.0.2 but ended up with Newtonsoft.Json 1.0.0.

I've tried removing/re-adding the references several times, all to no avail. I did notice that several of the ASP.NET libraries use Newtonsoft.Json 6.0.6 -- I'm not sure if this has anything to do with it.

If I navigate to the wrap folder --> Newtonsoft.Json --> json file, and replace "Newtonsoft.Json 1.0.0-*" with "Newtonsoft.Json 8.0.2-*", it fixes the references for the DNX 4.5.1 node.

However, errors still show afterwards saying that Newtonsoft.Json 8.0.2 referenced in my class library does not support DNXCore 50.

I'm at a loss as to what to do. Any help would be greatly appreciated.

K. Akins
  • 657
  • 1
  • 7
  • 12
  • 2
    You should upload somewhere the full project which you use. i suppose that your project had now `wrap` directory which include `project.json` with wrong version information about `Newtonsoft.Json`. See [my old answer](http://stackoverflow.com/a/34894737/315935). – Oleg Feb 02 '16 at 17:54
  • Thanks for your reply Oleg! I did look at your previous post and I believe it helped. I had to remove the wrap --> Newtonsoft.Json folder from my project directory, and then I could add the reference with no errors. – K. Akins Feb 03 '16 at 02:29
  • You are welcome! I'm glad that I could help you. – Oleg Feb 03 '16 at 06:20

1 Answers1

0

Answer to my issue: Thanks to Oleg's response I was able to make it work -- however there were two hurdles. One was the "wrap" folder that was created for Newtonsoft.Json. In the root of my solution was a "wrap" folder that contained a folder called Newtonsoft.Json. Apparently(?) that folder shouldn't have been created (how it was created I have no idea). Once removing that, I was able to add a reference to my custom class library without any errors referencing Newtonsoft.Json.

However when I began trying to use my custom assembly as in code, I would get an error about DNX50 not being supported -- which sort've makes sense because my custom referenced assembly was a .NET 4.5.1 class library.

This GitHub link has many people experiencing a similar issue

However, I managed to get everything to build and errors to go away by removing targeting for DNXCore50. This worked for me because I was just wanting to share some POCO data models between a Web API and WPF project. I'm not interested in targeting DNXCore at the moment.

I'm looking forward to the future of ASP.NET, but the newness is a bit challenging, at least for me.

K. Akins
  • 657
  • 1
  • 7
  • 12