Summary
The test It_throws_a_warning_when_NuGetPackageRoot_is_empty in GivenThatWeWantToUseFrameworkRoslyn.cs is consistently failing on all PRs targeting release/10.0.3xx for 11+ days. The test passes on main.
Details
The test expects NETSDK1221 to be emitted when NuGetPackageRoot is empty during combined /t:Restore;Build with Full Framework MSBuild. However, on the release/10.0.3xx SDK (which bundles NuGet 7.6.0), NuGetPackageRoot is no longer empty at evaluation time — it appears to be pre-populated from the NUGET_PACKAGES environment variable that the test sets.
On main (SDK 11.x, NuGet 7.9.0): NuGetPackageRoot is empty at evaluation → warning fires → test passes ✅
On release/10.0.3xx (SDK 10.0.3xx, NuGet 7.6.0): NuGetPackageRoot is NOT empty at evaluation → no warning → test fails ❌
Both use the same MSBuild 18.7.1 (VS 18 Insiders) on the Helix test machine. The SDK targets code is identical between branches.
Evidence
Root Cause Hypothesis
NuGet 7.6.0 (bundled in SDK 10.0.3xx) appears to initialize NuGetPackageRoot from the NUGET_PACKAGES environment variable during evaluation, which makes the property non-empty even for fresh projects with no .nuget.g.props. NuGet 7.9.0 (bundled on main) does not do this, preserving the old behavior where NuGetPackageRoot remains empty until .nuget.g.props is imported.
This means the underlying bug (issue #43016) may be fixed in NuGet 7.6.0, making the NETSDK1221 warning unnecessary in this scenario.
Possible Fixes
- Update the test to not set
NUGET_PACKAGES env var (so NuGetPackageRoot is truly empty regardless of NuGet version)
- Condition the test on the NuGet version behavior
- Remove the test if the underlying issue is genuinely fixed by NuGet 7.6
Context
/cc @jjonescz
Summary
The test
It_throws_a_warning_when_NuGetPackageRoot_is_emptyinGivenThatWeWantToUseFrameworkRoslyn.csis consistently failing on all PRs targetingrelease/10.0.3xxfor 11+ days. The test passes onmain.Details
The test expects NETSDK1221 to be emitted when
NuGetPackageRootis empty during combined/t:Restore;Buildwith Full Framework MSBuild. However, on therelease/10.0.3xxSDK (which bundles NuGet 7.6.0),NuGetPackageRootis no longer empty at evaluation time — it appears to be pre-populated from theNUGET_PACKAGESenvironment variable that the test sets.On main (SDK 11.x, NuGet 7.9.0):
NuGetPackageRootis empty at evaluation → warning fires → test passes ✅On release/10.0.3xx (SDK 10.0.3xx, NuGet 7.6.0):
NuGetPackageRootis NOT empty at evaluation → no warning → test fails ❌Both use the same MSBuild 18.7.1 (VS 18 Insiders) on the Helix test machine. The SDK targets code is identical between branches.
Evidence
20d94c9e-9551-4fc7-9943-e24477f646cfconsole log shows build succeeds with 0 warningsRoot Cause Hypothesis
NuGet 7.6.0 (bundled in SDK 10.0.3xx) appears to initialize
NuGetPackageRootfrom theNUGET_PACKAGESenvironment variable during evaluation, which makes the property non-empty even for fresh projects with no.nuget.g.props. NuGet 7.9.0 (bundled on main) does not do this, preserving the old behavior whereNuGetPackageRootremains empty until.nuget.g.propsis imported.This means the underlying bug (issue #43016) may be fixed in NuGet 7.6.0, making the NETSDK1221 warning unnecessary in this scenario.
Possible Fixes
NUGET_PACKAGESenv var (soNuGetPackageRootis truly empty regardless of NuGet version)Context
05a82501a985, Sep 2024)e5f35a28bbfcadding-p:DOTNET_HOST_PATH=args (Apr 2025, also @jjonescz)release/10.0.3xx/cc @jjonescz