microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.38k stars 683 forks source link

Dependency version conflict after switching to .net 8. #9937

Open alex4998 opened 3 months ago

alex4998 commented 3 months ago

Describe the bug

It looks like a bug in the build process or in the references, and it is something related particularly to WinUI. All other projects were switched to .net 8 without any issues. Totally I have 13 warnings like this

Consider app.config remapping of assembly "System.IO.MemoryMappedFiles, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "0.0.0.0" [] to Version "8.0.0.0" [C:\Misc\Project\Visualizer\bin\x64\Debug\net8.0-windows10.0.22621\win10-x64\System.IO.MemoryMappedFiles.dll] to solve conflict and get rid of warning.

I can provide the whole list of warnings if that is necessary. What I found so far is that many if not all .net 8 assemblies like System.Core.dll reference other assemblies specifying version as 0.0.0.0, for example it references "System.IO.MemoryMappedFiles, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". At the same time there are other assemblies which are dependencies of deeper levels of other assemblies like netstandard.dll, System.Reflection.Metadata.dll, DirectWriteForwarder.dll, System.Printing.dll which reference the same assembly of the actual version, 8 in this case, "System.IO.MemoryMappedFiles, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Looks like that System.Printing.dll itself is referenced from "PresentationFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which is part of WinUI3.

Let me represent my understanding of what happens in a more structural manner

"PresentationFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" -> "System.Printing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" -> "System.IO.MemoryMappedFiles, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

"System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" (.NETCoreApp v8.0) -> "System.IO.MemoryMappedFiles, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

Versions of System.IO.MemoryMappedFiles don't match.

Steps to reproduce the bug

Switch from .net 8-N to .net 8.

Expected behavior

No build time warnings regarding versions conflicts.

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

codendone commented 2 months ago

Can you share a sample repro project?