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 .NET portable libraries which are a .NET framework assembly 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:

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

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

  3. 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.

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

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

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

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

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

  9. A CookieContainer instance is exposed on the generated client.

  10. 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

  11. The ISerializable interface is not supported.

  12. Net.Tcp and PollingDuplex bindings are not supported

  13. The DataContractSerializer will always be used for faults.

  14. IsWrapped is not supported in portable subset projects.

See Also

Accessing Services Using a WCF Client
Portable Class Library