microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
https://www.fluentui-blazor.net
MIT License
3.84k stars 373 forks source link

fix: Cannot install the 3.0.0 package in MAUI Blazor due to Microsoft.Extensions.Logging.Abstractions requirements #654

Closed datvm closed 1 year ago

datvm commented 1 year ago

πŸ› Bug Report

I also posted a question on StackOverflow but I guess it may be an issue with this package.

I just created a MAUI Blazor project (hybrid) in Visual Studio. My SDK is the latest (7.0.400) and my VS is also up-to-date (17.7.3).

However, the referred packages (Microsoft.Extensions.Logging.Abstractions is in interest here) stays at 7.0.0:

enter image description here

Now when I try to install Microsoft.Fast.Components.FluentUI, it requires Microsoft.Extensions.Logging.Abstractions (>= 7.0.1) so I receive this error:

Error NU1605 Warning As Error: Detected package downgrade:
Microsoft.Extensions.Logging.Abstractions from 7.0.1 to 7.0.0. Reference the package directly from the project to select a different version.
MyProject -> Microsoft.Fast.Components.FluentUI 3.0.0 -> Microsoft.AspNetCore.Components.Web 7.0.10 -> Microsoft.AspNetCore.Components 7.0.10 -> Microsoft.AspNetCore.Authorization 7.0.10 -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
MyProject -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)

Now from Visual Studio's Nuget UI I cannot install the package directly so I did through the CLI and there is this error:

error: Error while performing Update for package 'Microsoft.Extensions.Logging.Abstractions'. Cannot edit items in imported files -
error: Item 'PackageReference' for 'Microsoft.Extensions.Logging.Abstractions' in Imported file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.92\Sdk\BundledVersions.targets'.

So I just add it directly to my project (.csproj):

<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />

Now after a restore and reload, I can add Microsoft.Fast.Components.FluentUI package but every time I build, I get this warning:

A PackageReference for 'Microsoft.Extensions.Logging.Abstractions' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs

How do I get rid of that annoying message? What is the problem here? Can I fix it or MS forgot to update their SDK references?

I also just noticed that with (>= 7.0.0) requirement, shouldn't it be able to resolve with 7.0.1? Is it actually a Nuget problem?

πŸ’» Repro or Code Sample

N/A

πŸ€” Expected Behavior

I should be able to install Microsoft.Fast.Components.FluentUI package

😯 Current Behavior

πŸ’ Possible Solution

Either the SDK reference needs to upgrade it to 7.0.1 or the library needs to be packed with 7.0.0 requirement.

πŸ”¦ Context

🌍 Your Environment

vnbaaij commented 1 year ago

Hi,

This is a (known) issue on the MAUI side. See https://github.com/dotnet/maui/issues/16244.

Maybe you can try the suggested workaround: https://github.com/dotnet/maui/issues/16244#issuecomment-1694418415

Closing this here as it is not something we can solve on our side.