[main] Fix Blazor WASM template tests NU1603 with DevServer version pinning#65784
Merged
[main] Fix Blazor WASM template tests NU1603 with DevServer version pinning#65784
Conversation
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.
Contributor
There was a problem hiding this comment.
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
MicrosoftAspNetCoreComponentsWebAssemblyDevServerVersionintoDirectory.Build.targets.inviaPrepareForTest.targets - Add a
<PackageReference Update>with exact version range in the generated.targetsfile
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.
akoeplinger
approved these changes
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>
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.
Forward port of #65781 to main.
Preventive fix — the NU1603 currently only hits
release/10.0(stable servicing packages from darc feeds outrank prerelease-cibuilds). Onmainall versions are prerelease so the conflict does not occur today, but this will be needed whenmainbranches forrelease/11.0.Same fix: pin the DevServer package to the exact locally-built version in
Directory.Build.targets.inviaPrepareForTest.targets.Fixes #65701