我们有一个使用 WCF 5.0 和 WindowsAzure SDK 的项目。
有两个引用 Microsoft.Data.Services.Client.dll 和 System.Data.Services.Client.dll,它们存在冲突。如果我删除系统 DLL(按照 this ),我将无法使用 windowsAzure SDK。如果删除 Microsoft DLL,我将无法利用 WCF 特别是 OData 3.0 版的新功能。
删除系统 DLL 引用后:
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'
其他信息:
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'.
如果我删除对 Microsoft.Data.Services.Client 的引用并添加对 System.Data.Services.Client 的引用,那么我们不会收到任何错误 - 我们也不会收到 WCF 5.0!
最佳答案
我能够相当快地重现这个问题。 Microsoft.WindowsAzure.StorageClient.Dll 对 System.Data.Service.Client.Dll 具有直接引用依赖性,如下所示,因此如果要使用 Azure 存储客户端 API,则必须引用 System.Data.Service.Client.Dll在您的应用程序中,并确保您不能使用 WCF 5.0 SDK 提供的 oData 3.0。更多信息发布在下面的问题中:
关于wcf - 使用 Microsoft.Data.Services.Client.dll 而不是 System.Data.Services.Client.dll 会导致 Azure.StorageClient 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10675104/