During the implementation of a duplex service, I created a new class and I decorated it with the attribute DataContract: moreover, I decorated the properties of this class with the attribute DataMember, including the property public IPEndPoint Endpoint { get; set; }.
Then I launched svcutil which has generated the generatedProxy.cs and the app.config files. The build of the project is successful, but some warnings are reported as follows:
The type ‘System.Net.IPEndPoint’ in
‘C:\Users\vincenzo\Documents\Visual Studio
2010\Projects\SampleDuplex\Client\generatedProxy.cs’ conflicts with
the imported type ‘System.Net.IPEndPoint’ in ‘c:\Program
Files\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\System.dll’.
Using the type defined in ‘C:\Users\vincenzo\Documents\Visual Studio
2010\Projects\SampleDuplex\Client\generatedProxy.cs’. C:\Users\vincenzo\Documents\Visual
Studio
2010\Projects\SampleDuplex\Client\generatedProxy.cs 90 28 Client
What causes these warnings?
The problem was caused by the fact that the generated file contained the definition of the namespace
System.Net, and within this namespace there was also the definition of theIPEndPointclass: this was in conflict with the definition of the .NET Framework. In order to resolve the problem, I added the/referenceoption to svcutil command, as follows:C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0/reference:System.dllAs a result, the definition of the namespace System.Net is no longer present in the generated file and after the build no warnings are reported.