Skip to content

Windows packaging fails when MAUI project name has an underscore in it #26486

@MSLukeWest

Description

@MSLukeWest

Description

When creating a new .NET MAUI app, the Package.AppxManifest file found under "Platforms\Windows" starts with the following Identity element:

<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.3.0" />

Then, during the build, "maui-package-name-placeholder" gets replaced by "com.companyname.". So, if the app name is something like "MAUI_app", it will be "com.companyname.MAUI_app".

The problem is that underscore is an invalid character here, so this leads to build errors shown below. Since the MAUI targets are generating this value, it should make sure only legal characters are used.

See:

if (!string.IsNullOrEmpty(ApplicationId))

Steps to Reproduce

  1. Create a new MAUI app with an underscore in the name, like MauiApp_21_Debug_AnyCPU_net9.0-windows10.0.19041.0_Build_2024-12-09T17_50_26.5698675-08_00.binlog.txt

  2. If you're using .NET 9.0, set the WindowsPackageType property to "MSIX" (this is the default in .NET 8.0 )

  3. Create a sideload published app, using either Visual Studio or the CLI (my attached binlog is from the IDE)

Result: Build Errors:

1>MakeAppx(0,0): Error : Error info: error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 10, Column 13, Reason: 'com.companyname.MauiApp2_21' violates pattern constraint of '[-.A-Za-z0-9]+'.
1>MakeAppx(0,0): Error : Package creation failed.
1>MakeAppx(0,0): Error : 0x80080204 - The specified package format is not valid: The package manifest is not valid.

Link to public reproduction project repository

No response

Version with bug

9.0.12 SR1.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

All Windows versions

Did you find any workaround?

You can set the value of this element to something valid in the input manifest. However, this isn't obvious to most customers, as the error is reported to them as coming from AppxManifest.xml under the bin directory.

Relevant log output

binlog attached, rename it from .binlog.txt to just .binlog

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizerplatform/windowst/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions