Home > database >  Error publishing .NET MAUI project: the target "_GenerateAppxPackage" does not exist
Error publishing .NET MAUI project: the target "_GenerateAppxPackage" does not exist

Time:11-01

I have a .NET MAUI project that was created with VS2022 Preview 2, and it builds without errors or warnings and works as expected in the debugger. Prior to updating Visual Studio to Version 17.4.0 Preview 4.0 I was able to publish the project as a sideloadable MSIX from within VS.

Since updating, I get the following error when I click Create in the Create App Packages wizard:

MSB4057 The target "_GenerateAppxPackage" does not exist in the project.

The error is listed against the MAUI project's .csproj file.

I've tried creating a separate new, default MAUI project in the new preview - this publishes ok and (as far as I can see) doesn't contain _GenerateAppxPackage anywhere within its files or project structure. So for now I'm assuming this isn't something new that was added with the preview.

I found some references to _GenerateAppxPackage on the web but they appear to refer to Azure integration. My project is a stand-alone data transformation app that doesn't even access the net.

I'm at a loss what to try next. I don't know what this target refers to, where it should "exist" within the project, or what it does. Can anyone help me understand the problem and/or point me to a solution?

Update: 2022-10-28:

  • I tried deleting the project structure and creating it from scratch with File -> New Project, then adding back only the .cs and .xaml files. Publishing the recreated project gives me the same error.

  • I also tried uninstalling the VS preview and re-downloading and installing it. Again, publishing the project gives me the same error.

I still have no idea what is causing this, or even where to start looking.

CodePudding user response:

I learned today that MAUI is now in the mainline Visual Studio 2022 edition, I've tried using that instead of the preview, and I can confirm that the problem goes away. I wish I'd known about this earlier...

  • Related