I am following along in the Ice User tools guide for 10.2.600 and I am trying to handle the response using the following code:
var functionResult = functionResponse.GetJsonResult();
I already added the Ice.Lib.RestClient assembly and all compiles just fine until I get to the above code.
The error is stating I am missing Newtonsoft.Json.Linq.JObject, which I assume should be included in the Ice.Lib.RestClient library.
Compiling Custom Code ...
----------errors and warnings------------
Error: CS0012 - line 157 (344) - The type 'Newtonsoft.Json.Linq.JObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
** Compile Failed. **
It a separate library from RestClient. Check out Mr Shoemaker,s post, especially the using statements. The library ships with Epicor, no install required if working within Epicor.
Sorry I thought it was clear from the screenshots, but this is working within Epicor in a client customization and I was simply following along with the example in the User Guide.
I added the reference to the Ice.Lib.RestClient library, but it still requires an additional library (Newtonsoft.Json) to be added manually in order to work.
I would have assumed that since RestClient is a client library already, it would include any dependencies (in this case Newtonsoft.Json) to work, but that’s not what I am finding.
Edit: It looks like it ships with it, but one does need to add their own using statement to it
It depends (no pun…OK, maybe a little) on how the library is packaged. Some may link dependencies into the shipping library but others rely on the locally installed versions. This is why people love containers…but that’s for another day!
BTW, James Newton-King, the author of Newtonsoft, now works for Microsoft. And Microsoft is starting to fold the capabilities of the Newtonsoft library into the .Net library System.Text.Json, which will be the library moving forward. I don’t think James is developing the old library and is just doing patches - although it is already a very feature complete library. Microsoft has recommendations here moving away from Newtonsoft to System.Text.Json, which is available in .Net Framework 2.4.7.2+, .Net Standard 2.0, .Net Core 2.0+.