dotnet / dotnet/maui

Use UseMaui=true in a razor component breaks the _content/PackageId

Open
#3,288 16 comments 1 reaction 0 assignees View on GitHub
area-blazor discussed feature-blazor-sdk Priority:1 s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Adding `true` to a razor component library causes the static we assets not to be packaged correctly.

I think this has to do with the fact our maui blazor targets assume an app and thus force set the BasePath to be `/` instead of first checking the context - final app or library,

### Steps to Reproduce

1. Create a maui blazor app that references a plain razor component library
2. Observe a successful run
3. Add UseMaui=true to the razor compoent
4. Observe that the razor component no longer loads

### Expected Behavior

### Actual Behavior

### Basic Information

- Version with issue:
- Last known good version:
- IDE:
- Platform Target Frameworks:
- iOS:
- Android:
- UWP:
- Android Support Library Version:
- Nuget Packages:
- Affected Devices:

### Screenshots

### Reproduction Link

### Workaround

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a .NET MAUI Blazor app referencing a plain Razor component library, then add true to the library. Inspect the MAUI Blazor targets and how they set BasePath for the final app versus the library. Done means the component loads and its _content/PackageId static web assets are packaged correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.