After upgrading to VS2012 and .NET 4.5 (but still running VS2010 and .NET 4.0), when running/compiling a .NET 4.0 website that references the .NET 4.0 version of JSON.NET and also contains service references we get the following error when
trying to compile the website:
Reference.svcmap: Failed to generate code for the service reference 'SERVICE REFERENCE NAME'. Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.
From several documented items on stack overflow and a couple of blogs, the answer is to
A) uninstall VS2012 & .NET4.5 (NOT AN OPTION)
B) remove JSON.NET from resused library references when adding each serivice reference
(possible, but we have 20+ service references and selecting each item in the add service reference dialog to be reused each time is rediculously inefficient)
C) or remove JSON.NET from your solution (NOT AN OPTION, heavily dependent)
Has this been addressed?