Skip to content

[main] Fix Blazor WASM template tests NU1603 with DevServer version pinning#65784

Merged
lewing merged 1 commit intomainfrom
lewing/fix-devserver-nu1603-main
Mar 16, 2026
Merged

[main] Fix Blazor WASM template tests NU1603 with DevServer version pinning#65784
lewing merged 1 commit intomainfrom
lewing/fix-devserver-nu1603-main

Conversation

@lewing
Copy link
Copy Markdown
Member

@lewing lewing commented Mar 15, 2026

Forward port of #65781 to main.

Preventive fix — the NU1603 currently only hits release/10.0 (stable servicing packages from darc feeds outrank prerelease -ci builds). On main all versions are prerelease so the conflict does not occur today, but this will be needed when main branches for release/11.0.

Same fix: pin the DevServer package to the exact locally-built version in Directory.Build.targets.in via PrepareForTest.targets.

Fixes #65701

PackageReference Update in Directory.Build.props runs before the
project file, so it cannot affect items declared in the project.
Move to Directory.Build.targets.in which is imported after, and
pipe the version variable to the targets template instead.
Copilot AI review requested due to automatic review settings March 15, 2026 03:53
@github-actions github-actions Bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Mar 15, 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

Forward port of #65781 to main. Pins the DevServer package to the exact locally-built version during template tests to prevent NU1603 when stable versions from darc feeds outrank prerelease builds.

Changes:

  • Pipe MicrosoftAspNetCoreComponentsWebAssemblyDevServerVersion into Directory.Build.targets.in via PrepareForTest.targets
  • Add a <PackageReference Update> with exact version range in the generated .targets file

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets Pass DevServer version property to template generation
src/ProjectTemplates/TestInfrastructure/Directory.Build.targets.in Pin DevServer package to exact locally-built version

You can also share your feedback on Copilot code review. Take the survey.

@lewing lewing requested review from akoeplinger and wtgodbe March 16, 2026 14:24
@lewing lewing merged commit 7c53dac into main Mar 16, 2026
31 checks passed
@lewing lewing deleted the lewing/fix-devserver-nu1603-main branch March 16, 2026 16:23
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview3 milestone Mar 16, 2026
ilonatommy added a commit to ilonatommy/aspnetcore that referenced this pull request 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 added a commit to ilonatommy/aspnetcore that referenced this pull request 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 added a commit that referenced this pull request Apr 14, 2026
* Fix DevServer version pin in template test infrastructure

The version pin added in #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 #66293

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Unquarantine BlazorWasmTemplateTest and WebWorkerTemplateE2ETest

Remove quarantine attributes added in #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>

---------

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-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Known Build Error] Blazor WASM template tests fail with NU1603: DevServer 10.0.6-ci not found, 10.0.6 resolved instead

3 participants