In this similar issue in MSB4018 WinAppSdkGenerateAppxPackageRecipe .NET Maui compile error #13117, a known solution was proposed by user samsengupta.
Since this error was reported on line 1591 of .nuget\packages\microsoft.windowsappsdk\1.1.5\buildTransitive\Microsoft.Build.Msix.Packaging.targets, that indicated an appx/msix packaging issue, which is handled by the UWP workload, so I tried installing the UWP workload in Visual Studio 2022, and this fixed the problem for me.Note that on the fresh Windows 10, Visual Studio 2022 install, it worked without needing the UWP workload installed at all, so it seems like whatever was stale in the repro machine was freshened up by the UWP workload install.
The error codes, causes and solutions for these four new errors have been explained in detail in the official documentation. Please refer to the following documentation:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.