Fixing WinUI3 Error: System.EntryPointNotFoundException with Version 17.6.0 of Visual Studio
See the question and my original answer on StackOverflowThe problem is for some (probably historical) reason, the Microsoft.UI.Xaml nuget package was added to the project.
This package is a WinUI 2, not WinUI 3 package. It's latest version as of today is 2.8.4.
WinUI 2 is is a library of controls that provides official native Microsoft UI controls and features for Windows UWP apps.
But although WinUI 3 is internally based on the same source code as UWP, it's 100% binary incompatible. So the solution is to simply remove this package and use the standard WinUI3 packages, which are usually setup by Visual Studio-provided WinUI3 templates.
When using these templates, Microsoft.UI.Xaml.dll
is implicitly provided by the Microsoft.WindowsAppSDK
package.