【问题标题】:Can't Install Package Azure.Storage.Blobs.12.5.1 in VS2015VS2015 无法安装包 Azure.Storage.Blobs.12.5.1
【发布时间】:2020-12-13 10:41:48
【问题描述】:

我正在尝试开始使用 Azure Blob 存储。我正在运行 VS2015,但我安装了 .NET 4.8 SDK 并将我的项目设置为针对它。当我尝试安装 NuGet 包时,我得到了这个:

Could not install package 'Azure.Storage.Blobs 12.5.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework.

据此https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support.NET 4.7.2 相当于.NET 标准2.0,这似乎是包想要的。但我已经尝试过 .NET 4.7.2 和 4.8 并且包没有安装。

【问题讨论】:

    标签: azure visual-studio-2015 nuget azure-blob-storage


    【解决方案1】:

    Azure.Storage.Blobs 仅适用于 .NET Standard。

    我相信您需要将Microsoft.Azure.Storage.Blob 用于 .NET Framework(最低 4.5.2)

    到 Nuget 的链接是 here

    预计到达时间:

    我刚刚阅读了您问题的另一半。 .NET Framework 4.6.1 符合 .NET Standard 2.0。

    我要在这里冒昧地说一下 Visual Studio 2015 和 .NETStandard 2.0 包之间存在某种不兼容。我在 Visual Studio 2019 上的 .NET Framework 4.6.1 项目上对其进行了测试,它安装了该软件包。

    刚刚查了一下,发现是is the case。您至少需要 Visual Studio 2017。至少你还可以使用Microsoft.Azure.Storage.Blob

    【讨论】:

    • 所以我只为Windows开发。我听说过 .NET Core,什么是 .NET 标准? Microsoft 是否计划整合这些框架?
    • @John -- 我刚刚尝试在 .NET 4.6.1 项目上安装 Azure.Storage.Blobs,它工作得很好(在 Visual Studio 2019 中)。我将在这里冒昧地说这是 Visual Studio 2015 和 .NET Standard 之间的不兼容。
    【解决方案2】:

    所以 Azure 真的希望你使用 VS 2017 或更高版本。

    为了在从 TFS 中提取后在 VS 2015 上运行此功能,我执行了以下操作:

    1. 为 VS 2015 安装 NuGet 3.6.0 或更高版本:

    https://www.nuget.org/downloads

    1. 然后为 VS 2015 安装 .NET Standard 支持:

    https://download.microsoft.com/download/0/F/D/0FD852A4-7EA1-4E2A-983A-0484AC19B92C/dotnet-standard-support-vs2015-2.0.0-win-x86.msi

    1. 为 Azure 安装最新的 NuGet 包(确保不要使用已弃用但名称几乎相同的旧包):

    https://www.nuget.org/packages/Azure.Storage.Blobs/

    1. 由于 MS 尚未修复的已知问题,无法构建解决方案。所以在记事本中打开.vbproj 文件。在第一个 PropertyGroup 下,在结束标记之前添加这一行:

    <ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>

    【讨论】:

      【解决方案3】:

      不是 Visual Studio(在 VS 2017、2019 中出现同样的错误),而是项目需要是 .Net Core 而不是 .Net Framework。如前所述,您可以安装 Microsoft.Azure.Storage.Blob,但确实会收到警告说软件包已被弃用(并且它说使用 Azure.Storage.Blob 代替)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-01-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-23
        • 1970-01-01
        • 2015-12-10
        • 1970-01-01
        相关资源
        最近更新 更多