HerrimanCoder
HerrimanCoder

Reputation: 7218

No AppxManifest is specified, but WindowsPackageType is not set to MSIX

I have a very simple .NET MAUI app in VS2022 and I am getting this compile error:

Improper project configuration: no AppxManifest is specified, but WindowsPackageType is not set to MSIX.

Before trying to compile, I did the following:

  1. Unload project. Remove all lines references Windows, Mac, Tizen. I want this project to only work with iOS and Android.
  2. Deleted the project folders related to Windows, Mac, Tizen

How can I get this to compile for iOS/Android only?

Upvotes: 4

Views: 3467

Answers (2)

Nick Kovalsky
Nick Kovalsky

Reputation: 6452

A nice guide is here:

https://learn.microsoft.com/en-us/dotnet/maui/windows/setup?view=net-maui-9.0

In Visual Studio, in Solution Explorer, right-click on your .NET MAUI app project and select Properties. Then, navigate to the Application > Windows Targets tab and ensure that Create a Windows MSIX package is checked:

enter image description here

Visual Studio will modify your app's project file (.csproj) to remove the None line. In addition, your app's Properties/launchSettings.json file will have the commandName value changed from Project to MsixPackage:

{
  "profiles": {
    "Windows Machine": {
      "commandName": "MsixPackage",
      "nativeDebugging": false
    }
  }
}

Important

If your app defines multiple launch setting profiles you'll have to manually update the commandName value from Project to MsixPackage for each profile.

When deploying a packaged .NET MAUI Windows app, you'll need to enable Developer Mode in Windows. For more information, see Configure Windows for packaged app deployment: https://learn.microsoft.com/en-us/dotnet/maui/windows/setup?view=net-maui-9.0#configure-windows-for-packaged-app-deployment

IMPORTANT: And all of this will fail to work if you omit OutputType>Exe</OutputType> inside your csproj.

Upvotes: 0

user19938769
user19938769

Reputation: 31

add a xml file with name Package.appxmanifest in platforms/windows....and paste content into it from any demo project of maui, or download a sample.

Upvotes: 3

Related Questions