Add Service Reference in a Portable Subset Project

Portable subset projects enable .NET assembly programmers to maintain a single source tree and build system while still supporting multiple .NET implementations (desktop, Silverlight, Windows Phone, and Xbox). Portable subset projects only reference portable libraries that are .NET assemblies that can be used on any .NET implementation.

Add Service Reference Details

When adding a service reference in a portable subset project, the following restrictions are enforced:

  • For XmlSerializer, only literal encodings are allowed. SOAP encodings generate an error during import.

  • For services that use DataContractSerializer scenarios, a data contract surrogate is provided to ensure that reused types come only from the portable subset.

  • Endpoints which rely on bindings not supported in portable libraries (all bindings except BasicHttpBinding, WSHttpBinding without transaction flow, reliable sessions, or MTOM encoding, and equivalent custom bindings) are ignored.

  • Message headers are deleted from all message descriptions in all operations before import.

  • Non-portable attributes DesignerCategoryAttribute, SerializableAttribute, and TransactionFlowAttribute are removed from generated client proxy code.

  • Non-portable properties ProtectionLevel, SessionMode, IsInitiating, IsTerminating are removed from ServiceContractAttribute, OperationContractAttribute, and FaultContractAttribute.

  • All service operations are generated as asynchronous operations on the client proxy.

  • Generated client constructors which use non-portable types are removed.

  • A CookieContainer instance is exposed on the generated client.

  • A comment is inserted at the top of the file identifying the assembly and version of the code generator:// This code was auto-generated by Microsoft.VisualStudio.Portable.AddServiceReference, version 1.0.0.0

  • The ISerializable interface is not supported.

  • Net.Tcp and PollingDuplex bindings are not supported

  • The DataContractSerializer will always be used for faults.

  • IsWrapped is not supported in portable subset projects.

See also