.net - CloudTableClient 与.NET Core 不兼容?

标签 .net azure asp.net-core azure-cosmosdb azure-table-storage

我有一个 .NET Core 2.2 Web 应用程序,我正在尝试与我的 Azure 表存储资源进行通信。到目前为止我所拥有的:

using Microsoft.WindowsAzure.Storage;
using Microsoft.Azure.CosmosDB.Table;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplication1.Repositories
{
    public class AssetRepository
    {
        public AssetRepository()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse("cstring");
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
        }
    }
}

但是当我将鼠标悬停在 CreateCloudTableClient 上时我明白了Reference to type CloudStorageAccount claims it is defined in Microsoft.Azure.Storage.Common but it could not be found.

如何在 .NET Core 2.2 Web 应用中执行基本的表 CRUD?

最佳答案

您似乎混淆了新旧程序集。

using Microsoft.WindowsAzure.Storage;
using Microsoft.Azure.CosmosDB.Table;

可以使用对 Microsoft.Azure.CosmosDB.* 的较新 NuGet 引用,也可以使用较旧的 Microsoft.WindowsAzure.Storage 程序集,但不能同时使用两者。

例如:

using Microsoft.Azure.CosmosDB.Table;   // replaces Microsoft.WindowsAzure.Storage.Table
using Microsoft.Azure.Storage;          // replaces Microsoft.WindowsAzure.Storage

关于.net - CloudTableClient 与.NET Core 不兼容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53803969/

相关文章:

azure - 执行 Azure DevOps 构建管道时 - 收到消息 : This pipeline needs permission to access resources before this continue

.NET Core Azure WebJobs 不从 Azure 应用程序设置读取

azure - 文件开始流式传输到浏览器后,如何清理 Azure 本地存储中的文件和目录?

c# - ASP.NET MVC 6 文件夹授权

c# - 使用 Pbkdf2 加密通过 Salt 加密和验证哈希密码

asp.net-core - ViewLocalizer 不返回字符串

.net - WPF 与 System.Drawing

c# - 在Binder主持的Jupyter上设置C#和F#笔记本

.net - 如何使用响应式框架将两个异步操作链接在一起?

.net - 输入密码 Blazor 表单