Strange issue when adding a service reference to a project that has the JSON.NET library referenced Strange issue when adding a service reference to a project that has the JSON.NET library referenced json json

Strange issue when adding a service reference to a project that has the JSON.NET library referenced


When you add a service reference, WCF by default will reuse the classes from your assemblies that match the ones that will be generated otherwise.

This happens because, for example, you might develop both the service and the client and you might want to have a class library with all the classes referenced in both projects. This also makes sure that .NET default types (like arrays, lists, DateTime) are used.

You can change this default behavior like this:

  1. Click the Advanced button after you selected "Add service reference"

  2. Select "Reuse types in specified referenced assemblies"

  3. Check all the assemblies, except the ones that you don't want touse

Note that if you don't check the system assemblies, you will get a new type generated in the proxy file for every .NET type (like arrays, lists) as well.