我有.NetStandardProject,当我将此项目引用到基于.NetFramework的项目中时,该代码具有查询CosmosDB Table API的代码,而在调用该方法时却无法理解。
未找到方法:'System.Threading.Tasks.Task`1 Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteQuerySegmentedAsync(Microsoft.WindowsAzure.Storage.Table.TableQuery,Microsoft.WindowsAzure.Storage.Table.TableContinuationToken)'
答案 0 :(得分:0)
从.NET Framework项目中引用.NET Standard程序集过去是行不通的,但是在.NET 4.6.1中添加了对此功能的支持。
不幸的是,这是一个非常脆弱的功能,有时它需要程序集绑定重定向,而该重定向需要在构建过程中生成。
尽管“项目属性”对话框具有自动生成绑定重定向的选项,但这对库没有影响,因此您需要手动编辑.csproj file
以包括:
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
有关更多详细信息和说明,请参阅GitHub问题Issues with .NET Standard 2.0 with .NET Framework & NuGet和此one。
顺便说一句,您应该确保.net标准版本与.net框架相对应。这是您可以阅读的doc。