1

I generated a WCF proxy using svcutil when I tried to compile the file it generated the error(warning as error which I can't disable) that System.DateTimeOffset in your =proxy conficts with System.DateTimeOffset. I saw the proxy file it has DateTimeOffset. I used svctutil 4.0.30319.18052 to generate the proxy.

How to avoid this compilation error without disabling the check ? Application that uses the proxy is targeted for .net 4.0 version. svcutil documentation at msdn http://msdn.microsoft.com/en-us/library/aa347733.aspx mentions:

"If DateTimeOffset referenced, this type is used instead of generating a new type. If the application is written using .NET Framework 3.5, SvcUtil.exe references DateTimeOffset automatically."

But not sure what to make of it..

I used svcutil option /targetClientVersion:version35 and it didn't generate definition for DateTimeOffset. But my application is targeting .net 4.0 and I am not sure what else will break if target version 3.5, though I think it should be fine because .net4.0 is backward compatible with .net 3.5.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

1

The answer is already given above

I used svcutil option /targetClientVersion:version35 and it didn't generate definition for DateTimeOffset. But my application is targeting .net 4.0 and I am not sure what else will break if target version 3.5, though I think it should be fine because .net4.0 is backward compatible with .net 3.5.

For further documentation on this topic see https://msdn.microsoft.com/de-de/library/aa347733(v=vs.110).aspx.

I think that the intention behind the value version35 is version 3.5 and above. You have to rethink only in case you like to use a .Net framework with a lower version.