extentreports-csharp icon indicating copy to clipboard operation
extentreports-csharp copied to clipboard

Extent reports has a dependency on newtonsoft json with null publickeytoken causing build failure

Open shadohawk opened this issue 8 years ago • 2 comments

Getting a compile error when trying to use ExtentReports in a project that already references newtonsoft.json.

Error CS0433 The type 'JObject' exists in both 'ExtentReports, Version=3.0.2.0, Culture=neutral, PublicKeyToken=null' and 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

shadohawk avatar May 08 '17 23:05 shadohawk

Duplicated by #77

Adam-S-Daniel avatar Sep 28 '17 15:09 Adam-S-Daniel

Workaround:

  1. In the Visual Studio's Properties window for the project's Newtonsoft.Json reference, change the value of Aliases from global to global, foo.

  2. Insert extern alias foo; as the first line of any class that consumes Newtonsoft.Json.

  3. Qualify members with foo.. Example: foo.Newtonsoft.Json.JsonConvert.SerializeObject(someObject)}.

Adam-S-Daniel avatar Sep 28 '17 16:09 Adam-S-Daniel