Prevent Microsoft.AspNetCore.App.Internal.Assets from packing without framework assets - #68977
Merged
Merged
Conversation
… JS assets Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix packing of Microsoft.AspNetCore.App.Internal.Assets without framework assets
Prevent Microsoft.AspNetCore.App.Internal.Assets from packing without framework assets
Sep 2, 2026
Fail before NuGet writes Microsoft.AspNetCore.App.Internal.Assets when the JavaScript build is disabled, expected files are absent, or the final package input list omits an asset. Extend package layout coverage to include source maps. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9dfccfb4-d58e-4004-b6ff-cd528d1c1601
Preserve no-NodeJS and platform-specific-only build configurations by skipping package validation when Microsoft.AspNetCore.App.Internal.Assets is not packable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9dfccfb4-d58e-4004-b6ff-cd528d1c1601
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes directly enforce package integrity in the failing configuration and add corresponding automated package-layout coverage for the expected shipped assets.
Pull request overview
Prevents producing an incomplete Microsoft.AspNetCore.App.Internal.Assets NuGet package (notably when BuildNodeJS=false) by making the project non-packable in that configuration and adding pack-time validation to ensure required Blazor framework JS assets and source maps are present before packaging.
Changes:
- Marks
Microsoft.AspNetCore.App.Internal.Assetsas non-packable whenBuildNodeJS=falseand addsBeforePack/GenerateNuspec-time validation targets to fail packing if required assets are missing. - Refactors asset item definitions to centralize the expected Blazor framework files in a single item list used by both packaging and validation.
- Extends package-layout tests to verify both
.jsfiles and their.mapfiles are present in the produced package.
File summaries
| File | Description |
|---|---|
| src/Assets/Microsoft.AspNetCore.App.Internal.Assets.csproj | Disables packing when NodeJS build is off and adds pack input/output validation to prevent emitting incomplete internal-assets packages. |
| src/Components/WebView/test/StaticWebAssets/PackageLayoutTests.cs | Updates packaging assertions to require the two Blazor scripts and their source maps in the internal-assets package. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
maraf
approved these changes
Sep 3, 2026
akoeplinger
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent incomplete
Microsoft.AspNetCore.App.Internal.Assetspackages.Description
Microsoft.AspNetCore.App.Internal.Assetscould successfully produce a NuGet package without its required Blazor framework assets whenBuildNodeJS=false. The resulting package restored successfully but caused/_framework/blazor.web.jsto return 404 at runtime.This change ensures that an incomplete package is never emitted:
BuildNodeJS=false, preserving intentional no-NodeJS and source-build configurations._PackageFileslist is checked forblazor.web.js,blazor.server.js, and both source maps beforeGenerateNuspecruns.BeforePackhook so input validation also runs whenGenerateNuspecwould otherwise be incrementally up-to-date.Verification
BuildNodeJS=falsepack succeeds without producing a.nupkg.OnlyPackPlatformSpecificPackages=truepack succeeds without producing this RID-agnostic package.AssetsInternalPackage_ShipsBlazorScriptsAndSourceMapspasses against the built package.Fixes #68975