1

I've created a C# class as a wrapper to call a Json rest webservice that will be used in AX, and have added my C# project to AX and can see/reference the methods.

In my C# class, I'm using Newtonsoft.Json (Json.net) as a reference to help serialize/deserialize the Json string and I receive this error:

Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

I added it to the GAC and restarted the AOS with the same error. Is there a way to force dependent references to deploy with the project?

On the project I have Deploy to client = Yes and Deploy to Server = Yes.

William YK
  • 1,025
  • 12
  • 26
  • 3
    why are you adding to the GAC why don't you create a `Dependency` folder copy the dll there reference it there as well as add to then reference node from the dll in the Dependency folder.. then change the `Copy Local=false` to `Copy Local = true` on the properties of the dll when looking at it from the references node.. – MethodMan Jan 21 '16 at 22:46
  • Because I didn't know you could do that :). I'm going to give this a shot now. – William YK Jan 25 '16 at 18:25
  • not a problem let us know if that works or not – MethodMan Jan 25 '16 at 18:28
  • Thanks for the answer by the way, if you change to an answer instead of a comment I can yours right if/when it works. When you say create a `Dependency` folder...I'm using VS2010, I clicked `Project>NewFolder`, put it in that folder, added a reference and browsed to that local folder and chose the item and `Copy Local=true` was already set. `Embed Interop Types=false` if that matters. I have to restart the system and clear the other dll's first to make sure if I did it right. – William YK Jan 25 '16 at 18:33
  • make sure that you remove the reference from the references node then re-add it browsing to the Dependency folder.. let me know if that works if so I will change the comment to an answer.. thanks – MethodMan Jan 25 '16 at 18:36
  • 1
    I did this and it looks like it works thanks! – William YK Jan 25 '16 at 18:49

1 Answers1

0

Dependency folder copy the dll there reference it there as well as add to then reference node from the dll in the Dependency folder.. then change the Copy Local=false to Copy Local = true on the properties of the dll when looking at it from the references

also

Make sure that you remove the reference from the references node then re-add it browsing to the Dependency folder

MethodMan
  • 18,625
  • 6
  • 34
  • 52