question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MAUI 7.0.92 requires Microsoft.Extensions.Logging.Abstractions 7.0.0 while .NET 7.0.9 7.0.1

See original GitHub issue

Description

I’m not able to upgrade project using latest MAUI with .NET 7.0.9 because of Microsoft.Extensions.Logging.Abstractions conflict. Library with Microsoft Extensions.Localization requires 7.0.1 while net7.0-android and others needs 7.0.0

I’ve 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.

Steps to Reproduce

  1. Create MAUI Hybrid project
  2. Create Microsoft.NET.Sdk.Razor library with Microsoft.Extensions.Localization
  3. Add library reference to MAUI project
  4. Compile

Link to public reproduction project repository

not needed

Version with bug

Unknown/Other

Last version that worked well

7.0.49

Affected platforms

iOS, Android, Windows

Affected platform versions

.NET MAUI 7

Did you find any workaround?

no

Relevant log output

Restoring packages for C:\SCF\SCFLib\SCFLib\SCFLib.csproj...
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. 
 SCFLib -> Microsoft.Extensions.Localization 7.0.9 -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.1) 
 SCFLib -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
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. 
 SCFLib -> Microsoft.AspNetCore.Components.Web 7.0.9 -> Microsoft.AspNetCore.Components 7.0.9 -> Microsoft.AspNetCore.Authorization 7.0.9 -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.1) 
 SCFLib -> Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
Package restore failed. Rolling back package changes for 'SCFLib'.
Time Elapsed: 00:00:00.0982852

Issue Analytics

  • State:open
  • Created 2 months ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Kebechetcommented, Jul 27, 2023

I had the same problem and I did dotnet workload update + rebuilt the project and the problem disappeared

EDIT: Ok, it did not

https://github.com/dotnet/maui/issues/12953

EDIT2: This seems to work. Put this directly into your maui .csproj <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="7.0.1" />

0reactions
ericghollandcommented, Aug 21, 2023

Same issue. MAUI prevents loading a specific version (7.0.1) to force it to match. So only options appears to be to override it with

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

in the MAUI csproj file. Project builds with that override in place but produces error at runtime:

System.TypeLoadException: 'Could not load type of field ‘Microsoft.Extensions.Logging.LoggerFactory:_scopeProvider’ (6) due to: Could not resolve type with token 01000034 from typeref (expected class ‘Microsoft.Extensions.Logging.IExternalScopeProvider’

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET 7 + Servicing Milestone
NET MAUI is the . ... MAUI 7.0.92 requires Microsoft.Extensions.Logging.Abstractions 7.0.0 while .NET 7.0.9 7.0.1 area/upstream Upstream Dependencies, ...
Read more >
NetMaui Blazor + RazorClass Library
I updated the package Microsoft.Extensions.Logging.Abstractions from 7.0.0 to 7.0.1. VS2022_2.png. After build, the reference to the package Microsoft.
Read more >
Windows 10 .Net 6 or .Net 7 runtime getting error Could not ...
Windows 10 .Net 6 or .Net 7 runtime getting error Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0.
Read more >
Announcing .NET MAUI in .NET 8 Preview 7: Keyboard ...
NET MAUI is now available in .NET 8 Preview 7 introducing keyboard accelerators, and more fixes and improvements. This is the final preview ......
Read more >
Package Microsoft.Extensions.Logging.Abstractions 7.0.0 ...
I'm getting the below error when I try to add any nuget package to .NET 7 applications. "Package Microsoft.Extensions.Logging.Abstractions ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found