-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Replace UseStaticFiles() with MapStaticAssets() in Blazor Maui Web template #31618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…mplate Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot you have work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to cgmanifest.json. The file has been restored to its original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
Unrelated, undo this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted the unrelated changes to this templatestrings.json file. All templatestrings.json files have been restored to their original state in commit 4536815.
…files Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the Blazor MAUI Web template by replacing the legacy UseStaticFiles() middleware with the newer MapStaticAssets() approach for serving static assets in ASP.NET Core applications.
Key changes:
- Removes
app.UseStaticFiles()call from the middleware pipeline - Adds
app.MapStaticAssets()call positioned beforeMapRazorComponents() - Updates the template to follow current ASP.NET Core best practices
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
This PR updates the Blazor Maui Web template to use the modern ASP.NET Core
MapStaticAssets()middleware instead of the legacyUseStaticFiles()middleware.Changes Made
In
src/Templates/src/templates/maui-blazor-solution/MauiApp.1.Web/Program.cs:app.UseStaticFiles();callapp.MapStaticAssets();call placed beforeMapRazorComponents()Benefits
MapStaticAssets()is the recommended approach for serving static assets in modern ASP.NET Core applications as it:Testing
dotnet new maui-blazor-webFixes #31617.
Progress
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.