Search code examples
wcfazureodata

Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient


We have a project that uses WCF 5.0 and the WindowsAzure SDK.

There are two references Microsoft.Data.Services.Client.dll and System.Data.Services.Client.dll and they are in conflict. If I remove the System DLL (as per this) I am unable to use the windowsAzure SDK. If I remove the Microsoft DLL I am unable to take advantage of the new features of WCF specifically OData version 3.0.

After I remove the System DLL reference:

cannot convert from 'System.Data.Services.Client.SaveChangesOptions [c:\Program Files (x86)\Microsoft WCF Data Services\5.0\bin.NETFramework\Microsoft.Data.Services.Client.dll]' to 'System.Data.Services.Client.SaveChangesOptions'

Additional information:

The best overloaded method match for 'Microsoft.WindowsAzure.StorageClient.TableServiceContext.SaveChangesWithRetries(System.Data.Services.Client.SaveChangesOptions)' has some invalid arguments

The type 'System.Data.Services.Client.DataServiceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

If I remove the reference to Microsoft.Data.Services.Client and add reference to System.Data.Services.Client then we get no errors - we also get no WCF 5.0!


Solution

  • I was able to repro this problem fairly quickly. The Microsoft.WindowsAzure.StorageClient.Dll has direct reference dependency on System.Data.Service.Client.Dll as shown below so if you are going to use Azure Storage Client API you would have to reference System.Data.Service.Client.Dll in your application and sure you can not use oData 3.0 supplied by WCF 5.0 SDK. More info is posted in the SO question below:

    WCF 5.0 and oData 3.0 API not work with azure table storage