Microsoft.ui.xaml.dll not found. Workarounds.
After a few days without working on a MAUI app, I returned to it today only to have it blow up on my face.
Loudly.
After a few searches online (and a VS2022 update to 17.12.1) I was, finally, able to, at least, have the debugger in VS 2022, to catch an exception.
The luck combination was from here, which states:
Workaround
2 available workarounds
- Manually install the runtime that corresponds to the version you are using https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads
- MAUI 8.0.20+ is 1.5.2
- MAUI 8.0.10-8.0.14 is 1.4.2
- Set the project property in your MAUI app project. Ideally workaround 1 works for you. Disabling the DeploymentManager will cause some features of WinUI to no longer work.
<PropertyGroup> <WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize> </PropertyGroup>
I tried the first one workaround, without success.
Then I tried the second one, with partial success: at least, now, my app deploys and the debugger engages, and it captured this exception:
The full description of the exception:
{System.DllNotFoundException}
Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Stacktrace:
at BatchSorter.WinUI.Program.XamlCheckProcessRequirements()
at BatchSorter.WinUI.Program.Main(String[] args) in C:\Users\pauls\source\repos\FlinttsMints\BatchSorter.Maui\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\Platforms\Windows\App.g.i.cs:line 29
So, it was in a generated code (therefore a code I didn’t write (phew -- I thought it was me).
Looking at this generated code, The only thing I found was this:
[global::System.Runtime.InteropServices.DllImport("Microsoft.ui.xaml.dll")]
[global::System.Runtime.InteropServices.DefaultDllImportSearchPaths(global::System.Runtime.InteropServices.DllImportSearchPath.SafeDirectories)]
private static extern void XamlCheckProcessRequirements();
Which doesn’t tell me much.
A couple more searches, led me to this question, which had a similar problem but in 2021.
Even so, one of the solutions, the one posted by X-Misaya, seemed to work, namely, add this property to the project file:
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
Now my application is not showing the images.
Comments
Post a Comment