After installing studio 2012, building an application that targets framework 4.0.
I am getting the error:
Type 'System.Threading.Tasks.Task' cannot be serialized.
Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with ....
I have regenerated the service reference using svcutil.
Is there any way of specifying that all the asynchronous stuff is excluded from the reference?
?
As far as I know you can’t use WCF task based asynchronous pattern on .NET 4.0 (you could but you need to install the Async Targeting Pack for Visual Studio 2012), you need to upgrade to .NET 4.5 to get it working.
I suspect that you were using some kind of extension (like the AsynCTP) on Visual Studo 2010.
Here you can see which asynchronous patterns are supported on each framework version:
Synchronous and Asynchronous Operations .NET Framework 4
Synchronous and Asynchronous Operations .NET Framework 4.5