Azure-sdk-for-net: Upgrading From Microsoft.Azure.Storage.Blob To Azure.Storage.Blobs Breaks Azure Management Fluent API (Azure.Core)

Created on 18 Oct 2020  路  2Comments  路  Source: Azure/azure-sdk-for-net

Describe the bug
Upon noticing that Microsoft.Azure.Storage.Blob (11.2.2) was deprecated, I switched over to Azure.Storage.Blob (12.6.0). Immediately after doing so, I started getting compilation errors in a different part of my code. Specifically, this block...


IAzure azure = await Azure.Configure()
                          .WithLogLevel(HttpLoggingDelegatingHandler.Level.BodyAndHeaders)
                          .Authenticate(azureRMCredentials)
                          .WithDefaultSubscriptionAsync();

...began to fail, stating that .Conifgure() was not found. Also, the static "Azure" after the "await" is no longer recognized as a type by IntelliSense. Upon inspecting the references, both before and after cases of IAzure F12-ed to:

#region Assembly Microsoft.Azure.Management.Fluent, Version=1.0.0.66, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// C:\Users\---\.nuget\packages\microsoft.azure.management.fluent\1.34.0\lib\netstandard1.4\Microsoft.Azure.Management.Fluent.dll
#endregion

Expected behavior
No affect on other packages/APIs.

Actual behavior (include Exception or Stack Trace)
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Configure' does not exist in the namespace 'Azure' (are you missing an assembly reference?) ---.Infrastructure C:---.Infrastructure\Managers\VMManager.cs 57 Active

To Reproduce

  1. Install Nuget package Azure.Storage.Blob 12.6.0 in my Domain project.
  2. Visual Studio shows the above compilation error in my Infrastructure project that references Domain.
  3. This happens even if I then remove Microsoft.Azure.Storage.Blobs 11.2.2.

Environment:

  • Azure.Storage.Blobs 12.6.0

    • Both projects are netstandard2.1

  • .NET Core SDK (reflecting any global.json):
    Version: 3.1.403
    Commit: 9e895200cd

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.403\

Host (useful for support):
Version: 3.1.9
Commit: 774fc3d6a9

.NET Core SDKs installed:
3.1.401 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]Windows 10 .NET Framework 4.8]

  • IDE and version : Visual Studio 16.7.6

Thanks!

customer-reported needs-triage question

Most helpful comment

Thanks so much @tg-msft! Next time I'll attempt to employ basic C# principles instead of immediately giving up and blaming Nuget. :disappointed: Really appreciate the quick response! That worked great.

All 2 comments

This is just a quirk of C#'s name resolution. C# prefers namespaces over types when you have one of each named the same. To fix just fully qualify like Microsoft.Azure.Management.Fluent.Azure.Configure().WithXyz(...) or add a using FluentAzure = Microsoft.Azure.Management.Fluent.Azure; and then call FluentAzure.Configure().WithXyz(...).

Thanks so much @tg-msft! Next time I'll attempt to employ basic C# principles instead of immediately giving up and blaming Nuget. :disappointed: Really appreciate the quick response! That worked great.

Was this page helpful?
0 / 5 - 0 ratings