Skip to content

Fix DevServer version pin in template test infrastructure#66303

Merged
ilonatommy merged 2 commits intodotnet:mainfrom
ilonatommy:fix/blazorwasm-devserver-version-pin
Apr 14, 2026
Merged

Fix DevServer version pin in template test infrastructure#66303
ilonatommy merged 2 commits intodotnet:mainfrom
ilonatommy:fix/blazorwasm-devserver-version-pin

Conversation

@ilonatommy
Copy link
Copy Markdown
Member

@ilonatommy ilonatommy commented Apr 14, 2026

Summary

Fixes #66293
Fixes #66292

The version pin added in #65784 to prevent NU1603 errors during Blazor WASM template tests never worked because $(MicrosoftAspNetCoreComponentsWebAssemblyDevServerVersion) is not an MSBuild property available in the test build context - it is only computed dynamically during template packing by GenerateContent.targets via _GetPackageVersionInfo.

This caused the generated Directory.Build.targets to contain:

<!-- Condition is always false - pin is a no-op -->
<ItemGroup Condition="'' != ''">
    <PackageReference Update="Microsoft.AspNetCore.Components.WebAssembly.DevServer"
                      Version="[]" />
</ItemGroup>

When a darc feed contains a preview-versioned DevServer package that outranks the locally-built CI package in SemVer (e.g. 11.0.0-preview.1 > 11.0.0-ci), NuGet resolves to the feed version, triggering NU1603 which is fatal with TreatWarningsAsErrors.

Fix

  1. Fix version pin: Use $(PackageVersion) instead of the undefined property. $(PackageVersion) is always available in the build context and matches the DevServer package version (all aspnetcore packages share the same version from eng/Versions.props).

  2. Unquarantine tests: Remove quarantine attributes from BlazorWasmTemplateTest and WebWorkerTemplateE2ETest (added in [test-quarantine] Quarantine BlazorWasmTemplateTest and re-quarantine WebWorkerTemplateE2ETest; unquarantine ShutdownTests #66294) since the root cause is fixed.

After the fix, the generated file correctly contains:

<ItemGroup Condition="'11.0.0-dev' != ''">
    <PackageReference Update="Microsoft.AspNetCore.Components.WebAssembly.DevServer"
                      Version="[11.0.0-dev]" />
</ItemGroup>

Testing

  • Built the repo and verified the generated Directory.Build.targets now has the correct version pin
  • Ran BlazorWasmStandaloneTemplate_Works - passes

Copilot AI review requested due to automatic review settings April 14, 2026 05:33
@github-actions github-actions Bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Apr 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 fixes Blazor WASM template test infrastructure so it correctly pins Microsoft.AspNetCore.Components.WebAssembly.DevServer to the locally-built package version, preventing NU1603 restore failures when a higher-precedence preview package exists on a feed.

Changes:

  • Switch the version passed into the generated Directory.Build.targets template from $(MicrosoftAspNetCoreComponentsWebAssemblyDevServerVersion) (not available in the test build context) to $(PackageVersion) (available via repo versioning).

@ilonatommy ilonatommy added area-blazor Includes: Blazor, Razor Components feature-templates and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Apr 14, 2026
@ilonatommy ilonatommy self-assigned this Apr 14, 2026
The version pin added in dotnet#65784 to prevent NU1603 errors during Blazor WASM
template tests never worked because
is not an MSBuild property available in the test build context. It is only
computed dynamically during template packing by GenerateContent.targets.

This caused the generated Directory.Build.targets to contain an empty condition
('' != '') and empty version range ([]), making the pin a no-op. When a darc feed
contains a preview-versioned DevServer package that outranks the locally-built
CI package in SemVer (e.g. 11.0.0-preview.1 > 11.0.0-ci), NuGet resolves to
the feed version, triggering NU1603 which is fatal with TreatWarningsAsErrors.

Fix: use  which is always available in the build context and
matches the DevServer package version since all aspnetcore packages share the
same version.

Fixes dotnet#66293

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ilonatommy ilonatommy force-pushed the fix/blazorwasm-devserver-version-pin branch from eafe6c0 to f07b00e Compare April 14, 2026 05:39
Remove quarantine attributes added in dotnet#66294 since the root cause (broken
DevServer version pin) is fixed in the previous commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ilonatommy ilonatommy merged commit 07e95ae into dotnet:main Apr 14, 2026
25 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 14, 2026
github-actions Bot added a commit that referenced this pull request Apr 21, 2026
Both classes are failing again in build 1388488 after being unquarantined in #66303.
The DevServer version pin fix may not have fully resolved the underlying issue.

- Re-quarantine WebWorkerTemplateE2ETest at class level (issue #66292)
- Re-quarantine BlazorWasmTemplateTest at class level (issue #66293)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DeagleGross pushed a commit that referenced this pull request Apr 21, 2026
…emplateE2ETest (#66404)

Both classes are failing again in build 1388488 after being unquarantined in #66303.
The DevServer version pin fix may not have fully resolved the underlying issue.

- Re-quarantine WebWorkerTemplateE2ETest at class level (issue #66292)
- Re-quarantine BlazorWasmTemplateTest at class level (issue #66293)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components feature-templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine BlazorWasmTemplateTest (NU1603 NuGet restore failures) Quarantine WebWorkerTemplateE2ETest (re-quarantine after #66072)

3 participants