2013-06-01 23 views
5

Vấn đề là một số lớp (DataServiceClientException/DataServiceRequestException/DataServiceResponse) tồn tại trong cả System.Data.Services.Client.dll và Microsoft.Data.Services.Client. dll. Cách tiếp cận đơn giản sẽ là use only one of those libraries. Thật không may:Sử dụng Microsoft.WindowsAzure.StorageClient.TableServicesContext và phát hiện xung đột cập nhật đồng thời

  • System.Data.Services.Client.dll không thể được gỡ bỏ vì nó là cần thiết cho việc sử dụng Microsoft.WindowsAzure.StorageClient.TableServicesContext
  • Microsoft.Data.Services.Client.dll là cần thiết cho Microsoft. WindowsAzure.StorageClient.TableServicesContext trên Azure.

Thông thường hai thư viện này hoạt động tốt với nhau. Tuy nhiên, việc thực hiện các mã từ here để phát hiện xung đột đồng thời dẫn đến lỗi:

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' 

System.Data.Services.Client.DataServiceClientException, DataServiceRequestExceptionDataServiceResponse lớp không thể truy cập như chúng tồn tại trong cả hai thư viện. Làm cách nào để phát hiện xung đột cập nhật đồng thời trong khi sử dụng Microsoft.WindowsAzure.StorageClient.TableServicesContext?

Trả lời

7

Giải pháp là sử dụng tính năng extern alias của C#.

  1. Mở rộng phần tham chiếu của dự án của bạn.

  2. Nhấp chuột phải vào System.Data.Services.Client và chọn thuộc tính.

  3. Thay đổi bí danh từ "toàn cầu" thành "hệ thống" hoặc mục khác.

và dự án xây dựng tốt.

Các vấn đề liên quan