Inconsistent AssemblyVersion of Microsoft.Extensions.Logging.Abstractions between .NET and .NET462 #109044
Labels
area-Extensions-Logging
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
The latest stable Microsoft.Extensions.Logging.Abstractions.8.0.2.nupkg has an AssemblyVerion of
8.0.0.0
for .NET8 while attributing anther AssemblyVersion (8.0.0.2
) for .NET462.)This may lead confusing runtime error in some scenario.
Background
A
that uses some 3rd-party lagecy technology and must targets .NET472. This project has a referece onMicrosoft.Extensions.Logging.Abstractions.8.0.2.nupkg
.B
that refereces the above projectA
and also other .NET projects. The other projects also references the sameMicrosoft.Extensions.Logging.Abstractions.8.0.2.nupkg
Troubleshooting
The version 8.0.0. is suspicious. After inspecting the dlls in the debug folder, I find this dll AssemblyVersion is inconsistent between .NET and .NET462.
lib/
foldernet8.0/
folder and we can get the AssemblyVersion is 8.0.0.0net6.0/
folder and we can get the AssemblyVersion is 8.0.0.0net462/
folder and we can get the AssemblyVersion is 8.0.0.2So I guess here's the reason why my app B crash at runtime:
A
, which targets net472, use the info that the Microsoft.Extensions.Logging.Abstractions.dll is coming fromlib/net462/
, and thus believe that the AssemblyVersion is 8.0.0.2B
, which targets net8.0, finally copies the dll fromlib/net8/
, however, this dll's AssemblyVersion is 8.0.0.0 . And finally, it throws and complains that there's no assembly "Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2".Is it better to make the AssemblyVersion the same regardless of .NET or .NET Framework ?
The text was updated successfully, but these errors were encountered: