The problem is that some classes (DataServiceClientException / DataServiceRequestException / DataServiceResponse) exist in both System.Data.Services.Client.dll and Microsoft.Data.Services.Client.dll. The simple approach would be to use only one of those libraries. Unfortunately:
Normally these two libraries work fine together. However, implementing the code from here to detect concurrency conflicts results in errors:
Error 1 The type 'System.Data.Services.Client.DataServiceRequestException' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
Error 2 The type 'System.Data.Services.Client.DataServiceResponse' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
Error 3 The type 'System.Data.Services.Client.DataServiceClientException' exists in both 'C:\Program Files\Microsoft WCF Data Services\5.0\bin\.NETFramework\Microsoft.Data.Services.Client.dll' and 'C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll'
because System.Data.Services.Client.DataServiceClientException
, DataServiceRequestException
, and DataServiceResponse
classes cannot be accessed as they exist in both libraries. How does one detect concurrency update conflicts while using Microsoft.WindowsAzure.StorageClient.TableServicesContext?
The solution is to use C#'s extern alias feature.
Expand the references section of your project.
Right click on System.Data.Services.Client and choose properties.
Change Aliases from "global" to "system" or something else.
and the project builds fine.