microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.85k stars 326 forks source link

Duplicate entries for the same module generated in app.manifest when building self-contained #4713

Open dblohm7 opened 2 months ago

dblohm7 commented 2 months ago

Describe the bug

I'm building a self-contained module that won't load due to Fusion errors. Its assembly manifest contains multiple asmv3:file elements for Microsoft.UI.Xaml.dll, however the second, duplicate entry is listed as Microsoft.ui.xaml.dll (notice the difference in case). AFAICT the cause is that the implementation of GenerateAppManifestFromAppx is not dealing with case insensitivity of Windows filesystems when it removes the name of a processed DLL file from dllFiles.

The error message in the event log is Activation context generation failed for "foo.dll". Dll redirector contributor unable to add file map entry for file Microsoft.ui.xaml.dll; Two or more components referenced directly or indirectly by the application manifest have files by the same name.

Steps to reproduce the bug

  1. Publish to filesystem a NativeAOT, unpackaged, self-contained DLL that uses the Windows SDK. Runtime identifier set to win-x64.
  2. Try to load that DLL. The DLL load fails with the SideBySide entry in the event log as described above.

Expected behavior

There should not be duplicate entries in the app manifest for the same file.

Screenshots

No response

NuGet package version

Windows App SDK 1.6.0: 1.6.240829007

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

c4rlosmarin commented 3 weeks ago

I'm able to reroduce this issue. Got the very same error message while trying to execute a self-contained application through its .exe file.