How to: Configure a Service to Reuse Existing Types

When a service reference is added to a project, any types defined in the service are generated in the local project. In many cases, this creates duplicate types when a service uses common .NET Framework types or when types are defined in a shared library.

To avoid this problem, types in referenced assemblies are shared by default. If you want to disable type sharing for one or more assemblies, you can do so in the Configure Service References dialog box.

To disable type sharing in a single assembly

  1. In Solution Explorer, select the service reference.

  2. On the Project menu, click Configure Service Reference.

  3. In the Configure Service References dialog box, select Reuse types in specified referenced assemblies.

  4. Select the check box for each assembly in which you want to enable type sharing. To disable type sharing for an assembly, leave the check box cleared.

To disable type sharing in all assemblies

  1. In Solution Explorer, select the service reference.

  2. On the Project menu, click Configure Service Reference.

  3. In the Configure Service References dialog box, clear the Reuse types in referenced assemblies check box.

See Also

Reference

Configure Service Reference Dialog Box

Concepts

Windows Communication Foundation Services and WCF Data Services in Visual Studio

Other Resources

Consuming ASMX and WCF Services Sample