Question

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?

Was it helpful?

Solution

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 the IPEndPoint class: this was in conflict with the definition of the .NET Framework. In order to resolve the problem, I added the /reference option to svcutil command, as follows:

  1. I moved into the path C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
  2. I added the option /reference:System.dll

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top