Use SDK Asset Groups for Assets.Internal and Identity UI#66412
Conversation
1e93176 to
688db7f
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates internal static web asset packaging for Microsoft.AspNetCore.App.Internal.Assets and Microsoft.AspNetCore.Identity.UI from custom build/props/targets to the .NET SDK’s StaticWebAssetGroupDefinition / StaticWebAssetGroup mechanism, and updates repo consumers (Components + Identity samples/testassets) to select asset groups via new StaticWebAssets.Groups.targets convention files.
Changes:
- Switch asset delivery to SDK asset groups (Assets.Internal “BlazorFramework” group; Identity UI “BootstrapVersion” V4/V5 groups) and remove the legacy
build/,buildMultiTargeting/, andbuildTransitive/packaging artifacts. - Update repo consumers to import the new
StaticWebAssets.Groups.targetsfiles and remove the previous workaround targets/properties. - Simplify Components build settings by removing the
BlazorWebAssemblyJSPathoverride.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Identity/testassets/Identity.DefaultUI.WebSite/Identity.DefaultUI.WebSite.csproj | Switches to IdentityUIFrameworkVersion and imports Identity UI group-selection targets; removes legacy MSBuild wiring. |
| src/Identity/samples/IdentitySample.PasskeyUI/IdentitySample.PasskeyUI.csproj | Replaces the old Blazor framework assets workaround with an Assets.Internal reference + group-selection import. |
| src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj | Imports Identity UI group-selection targets and removes legacy MSBuild wiring. |
| src/Identity/UI/src/buildTransitive/Microsoft.AspNetCore.Identity.UI.targets | Removes legacy transitive targets shim. |
| src/Identity/UI/src/buildMultiTargeting/Microsoft.AspNetCore.Identity.UI.targets | Removes legacy multitargeting targets shim. |
| src/Identity/UI/src/build/Microsoft.AspNetCore.StaticWebAssets.targets | Removes legacy conditional Bootstrap V4/V5 static web asset imports. |
| src/Identity/UI/src/build/Microsoft.AspNetCore.Identity.UI.targets | Removes legacy targets import. |
| src/Identity/UI/src/build/Microsoft.AspNetCore.Identity.UI.props | Removes legacy props that set default UI framework + assembly attribute. |
| src/Identity/UI/src/StaticWebAssets.Groups.targets | Adds consumer-side group selection (BootstrapVersion) + assembly attribute injection. |
| src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj | Defines BootstrapVersion asset groups via SDK items; packs assets via Content discovery. |
| src/Components/Directory.Build.targets | Removes BlazorWebAssemblyJSPath override and replaces with explanatory comment. |
| src/Components/Directory.Build.props | Adds Assets.Internal reference + imports Assets group-selection targets in Components area. |
| src/Assets/buildTransitive/Microsoft.AspNetCore.App.Internal.Assets.targets | Removes legacy transitive targets shim. |
| src/Assets/buildMultiTargeting/Microsoft.AspNetCore.App.Internal.Assets.targets | Removes legacy multitargeting targets shim. |
| src/Assets/build/Microsoft.AspNetCore.App.Internal.Assets.targets | Removes legacy custom target that injected framework static web assets. |
| src/Assets/build/Microsoft.AspNetCore.App.Internal.Assets.props | Removes legacy (empty) props. |
| src/Assets/StaticWebAssets.Groups.targets | Adds consumer-side deferred group selection for the “BlazorFramework” asset group. |
| src/Assets/Microsoft.AspNetCore.App.Internal.Assets.csproj | Switches to Razor SDK; packs framework JS as static web assets and defines the “BlazorFramework” asset group. |
| Directory.Build.targets | Updates repo-level comment to reflect new consumption pattern (ProjectReference + Groups targets convention). |
4941a2d to
974ddd8
Compare
|
@azure-pipelines src/Components/Testing/tasks/Microsoft.AspNetCore.Components.Testing.Tasks.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project Microsoft.AspNetCore.App.Internal.Assets is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project Microsoft.AspNetCore.App.Internal.Assets supports: net11.0 (.NETCoreApp,Version=v11.0) @azure-pipelines src/Components/Testing/gen/Microsoft.AspNetCore.Components.Testing.Generators.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project Microsoft.AspNetCore.App.Internal.Assets is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project Microsoft.AspNetCore.App.Internal.Assets supports: net11.0 (.NETCoreApp,Version=v11.0) @azure-pipelines src/Components/Analyzers/src/Microsoft.AspNetCore.Components.Analyzers.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project Microsoft.AspNetCore.App.Internal.Assets is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project Microsoft.AspNetCore.App.Internal.Assets supports: net11.0 (.NETCoreApp,Version=v11.0) @azure-pipelines src/Components/Testing/tasks/Microsoft.AspNetCore.Components.Testing.Tasks.csproj(0,0): error NU1201: (NETCORE_ENGINEERING_TELEMETRY=Restore) Project Microsoft.AspNetCore.App.Internal.Assets is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project Microsoft.AspNetCore.App.Internal.Assets supports: net11.0 (.NETCoreApp,Version=v11.0) fix them. |
|
Fixed in bd2fbfc. The |
Hmm, note that Assets.Internal shouldn't generate any assembly or show as a dependency of any other library/package, make sure that's the case |
Addressed in 1beec52. The |
|
azure-pipelines .dotnet\sdk\11.0.100-preview.4.26210.111\NuGet.Build.Tasks.Pack.targets#L222 @azure-pipelines .dotnet\sdk\11.0.100-preview.4.26210.111\NuGet.Build.Tasks.Pack.targets#L222 @azure-pipelines .dotnet\sdk\11.0.100-preview.4.26210.111\NuGet.Build.Tasks.Pack.targets#L222 @azure-pipelines .dotnet\sdk\11.0.100-preview.4.26210.111\NuGet.Build.Tasks.Pack.targets#L222 @azure-pipelines .dotnet\sdk\11.0.100-preview.4.26210.111\NuGet.Build.Tasks.Pack.targets#L222 @copilot we are missing the pack only pattern in the group definitions. Look inside the swa sdk in the local .net to find it, or search the dotnet/sdk repo for samples. |
... Fixed in b7b2ede. Added |
5447135 to
978c098
Compare
97af508 to
bada73f
Compare
bada73f to
877e2f7
Compare
….WebAssembly Replace custom build/props/targets packaging with SDK StaticWebAssetGroupDefinition and StaticWebAssetGroup items (dotnet/sdk#53187). Assets.Internal changes: - Switch to Microsoft.NET.Sdk.Razor SDK - Add StaticWebAssetFrameworkPattern=**/*.js for framework asset marking - Use Content items with Link/ContentRoot metadata instead of custom _BlazorJSFile - Add StaticWebAssets.Groups.targets for consumer-side conditional inclusion - Remove blazor.webassembly.js (now provided by Components.WebAssembly) - Delete old build/, buildMultiTargeting/, buildTransitive/ directories Components.WebAssembly changes: - Switch to Microsoft.NET.Sdk.Razor SDK - Add StaticWebAssetFrameworkPattern=**/*.js for framework asset marking - Use Content items with Link/ContentRoot metadata for blazor.webassembly.js - Add StaticWebAssetGroupDefinition + StaticWebAssets.Groups.targets (group keyed on UsingMicrosoftNETSdkBlazorWebAssembly) - Remove BlazorWebAssemblyJSPath from package props (SWA pipeline handles it) Identity UI changes: - Replace custom GetIdentityUIAssets target with StaticWebAssetGroupDefinition for Bootstrap V4/V5 variants - Add StaticWebAssets.Groups.targets for consumer-side group selection - Delete old build/, buildMultiTargeting/, buildTransitive/ directories Consumer migration: - Components/Directory.Build.props: ProjectReference with PrivateAssets=All + Groups.targets imports (replaces workaround properties) - Components/Directory.Build.targets: Remove BlazorWebAssemblyJSPath override - Identity samples/testassets: Import Groups.targets, remove old targets
…x for Identity UI pack
The _ConfigureAssetsInternalReference target set ReferenceOutputAssembly=false during target execution (BeforeTargets=ResolveProjectReferences), but the E2E test pipeline invokes Components.TestServer and Wasm.Prerendered.Server with Targets='Build;Publish' and custom Properties, creating separate MSBuild project instances where the target-based approach didn't reliably prevent the compiler from trying to reference the non-existent Assets.Internal DLL. By setting the metadata via ProjectReference Update at evaluation time (outside any target), the metadata is always in effect regardless of which targets run or how many times the project is built with different global properties.
…ojects The BlazorWebAssembly group on blazor.webassembly.js should be cleared by the SDK when the asset crosses project boundaries as a framework asset. Until that SDK change is in place, declare the group in each hosting server project so the asset passes filtering. Simplify Assets.Internal groups to only declare BlazorFramework. Restore WebAssembly groups to final form (BlazorWebAssembly SDK only).
The original _AddBlazorFrameworkStaticWebAssets target required both OutputType == Exe/WinExe AND UsingMicrosoftNETSdkWeb. The group condition must match: only executable web apps should opt into the BlazorFramework group for blazor.web.js and blazor.server.js.
Change JS build output to include _framework/ in the directory structure so that it becomes part of RelativePath rather than BasePath. This ensures the _framework prefix survives framework asset materialization regardless of the consumer's BasePath. Changes: - Rollup config outputs to dist/Debug/_framework/blazor.*.js - Assets.Internal and WebAssembly csprojs: BasePath=/ with _framework in paths - Remove StaticWebAssetGroup workarounds from test/sample projects (no longer needed since the SDK properly filters by group before materialization) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Javier Calvarro Nelson <jacalvar@microsoft.com>
The StaticWebAssets.Groups.targets now falls back to the existing IdentityDefaultUIFramework property if IdentityUIFrameworkVersion is not explicitly set, so consuming projects don't need to rename their property. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update global.json to 11.0.100-preview.6.26277.116 - Remove redundant Microsoft.Extensions.Options reference in Validation Localization tests (NU1510 warns-as-error with new SDK pruning) - Fix stale comment in Components Directory.Build.targets about which package provides blazor.webassembly.js Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4e7b826 to
6bc8197
Compare

Replace custom build/props/targets packaging with SDK StaticWebAssetGroupDefinition and StaticWebAssetGroup items (dotnet/sdk#53187).
Assets.Internal changes:
Identity UI changes:
Consumer migration: