I got two error in the MAUI project when I try to run the project

Manash Dholey 0 Reputation points
2024-01-31T11:13:00.39+00:00

Below I attached the error message and screenshot:

Severity	Code	Description	Project	File	Line	Suppression State
Error	APPX0002	Task 'WinAppSdkGenerateAppxPackageRecipe' failed. The specified module could not be found
	MauiAppDemo	C:\Users\Primouser\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.Build.Msix.Packaging.targets	1587

	
Error	MSB4018	The "WinAppSdkGenerateAppxPackageRecipe" task failed unexpectedly.
System.ComponentModel.Win32Exception (0x80004005): The specified module could not be found
   at Microsoft.Build.Msix.MrmSupportLibrary.Load(String mrmSupportLibraryPath)
   at Microsoft.Build.Msix.MrmSupportLibraryResourceIndexMap..ctor(String mrmSupportLibraryPath, String projectDir)
   at Microsoft.Build.Msix.ResourceIndexMap.Create(String mrmSupportLibraryPath, Boolean useResourceIndexerApi, String projectDir, ITaskItem[] indexedPayloadFiles)
   at Microsoft.Build.Msix.Recipe.WinAppSdkGenerateAppxPackageRecipe.ExecuteImplementation()
   at Microsoft.Build.Msix.AppxPackagingTaskHelper.Execute(String file)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Build.Msix.AppxPackagingTaskHelper.Execute(String file)
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	MauiAppDemo	C:\Users\Primouser\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.Build.Msix.Packaging.targets	1587	

User's image

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,492 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,919 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 42,431 Reputation points Microsoft Vendor
    2024-02-02T03:04:00.4133333+00:00

    Hello,

    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.

    Update:

    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:

    Best Regards,

    Alec Liu.


    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.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.