Skip to content

MAUI projects with an ampersand in the name can't be built or loaded #21090

@MSLukeWest

Description

@MSLukeWest

Description

If I create a project with a name like "foo&bar" I'm unable to build it from the command line or open it in Visual Studio. Other types on .NET projects don't seem to have this issue.

Steps to Reproduce

  1. Open dev command prompt, run:

dotnet new maui --name "foo&bar"

  1. cd to "foo&bar"
  2. dotnet build

Result: Fails with:

error MSB4025: The project file could not be loaded. An error occurred whi le parsing EntityName. Line 24, position 25.

The line it's complaining about is the following (position number given is the one after the ampersand):

<ApplicationTitle>Foo&Bar</ApplicationTitle>

A potential fix is to use a different token here:

<ApplicationTitle>MauiApp.1</ApplicationTitle>

Note: You'll get a similar error if you try to load the project in Visual Studio:

image

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

No response

Did you find any workaround?

Don't use an ampersand in project names

Relevant log output

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions