无法在 VS2015 中安装包 Azure.Storage.Blobs.12.5.1

Can't Install Package Azure.Storage.Blobs.12.5.1 in VS2015

我正在尝试开始使用 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 standard 2.0,这似乎是程序包想要的。但我已经尝试过 .NET 4.7.2 和 4.8,但软件包没有安装。

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

我认为您需要使用 Microsoft.Azure.Storage.Blob for .NET Framework(最低 4.5.2)

Link 到 Nuget 是 here.

ETA:

我刚刚看了你问题的另一半。 .NET Framework 4.6.1 与 .NET Standard 2.0 兼容。

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

刚刚查了一下,。您至少需要 Visual Studio 2017 年。至少你还能用Microsoft.Azure.Storage.Blob.

所以 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 包(确保不要获取已弃用但接近 identically-named 旧包):

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

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

<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>

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