Skip to content

Allow NU5104 in MSBuild#3051

Merged
mmitche merged 2 commits intodotnet:release/10.0.1xxfrom
rainersigwald:allow-msbuild-stable-to-unstable-package-references-in-sourcebuild
Oct 23, 2025
Merged

Allow NU5104 in MSBuild#3051
mmitche merged 2 commits intodotnet:release/10.0.1xxfrom
rainersigwald:allow-msbuild-stable-to-unstable-package-references-in-sourcebuild

Conversation

@rainersigwald
Copy link
Member

Fixes dotnet/source-build#5376.

When MSBuild exposes a stable version, but dotnet/runtime does not, VMR
builds can fail with a warning-as-error like

.../NuGet.Build.Tasks.Pack.targets(221,5): error NU5104: Warning As Error: A stable release of a package should not have a prerelease dependency. Either modify the version spec of dependency "System.Formats.Nrbf [10.0.0-rtm.25514.101, )" or update the version field in the nuspec. [/home/tester/workdir/dotnet/src/msbuild/src/Tasks/Microsoft.Build.Tasks.csproj]

This is an error we want to keep in the MSBuild repo’s standalone build,
so that the official NuGet packages we ship don't violate the rule, but
it is not helpful in a unified build where the packages won't be
published and we always want to have a consistent, unified set of
references to what is building.

Avoid this by suppressing the warning for any project in the MSBuild
repo, conditional on whether we're in a source-build scenario.

Fixes dotnet/source-build#5376.

When MSBuild exposes a stable version, but dotnet/runtime does not, VMR
builds can fail with a warning-as-error like

    .../NuGet.Build.Tasks.Pack.targets(221,5): error NU5104: Warning As Error: A stable release of a package should not have a prerelease dependency. Either modify the version spec of dependency "System.Formats.Nrbf [10.0.0-rtm.25514.101, )" or update the version field in the nuspec. [/home/tester/workdir/dotnet/src/msbuild/src/Tasks/Microsoft.Build.Tasks.csproj]

This is an error we want to keep in the MSBuild repo’s standalone build,
so that the official NuGet packages we ship don't violate the rule, but
it is not helpful in a unified build where the packages won't be
published and we always want to have a consistent, unified set of
references to what is building.

Avoid this by suppressing the warning for any project in the MSBuild
repo, conditional on whether we're in a source-build scenario.
Co-authored-by: Matt Mitchell <mmitche@microsoft.com>
@mthalman
Copy link
Member

I've applied @mmitche's suggestion preemptively so we can have a passing build soon. @rainersigwald can choose to accept it or not

@rainersigwald
Copy link
Member Author

That works for me.

@mmitche mmitche enabled auto-merge (squash) October 23, 2025 14:23
@mmitche mmitche merged commit a7c1bb4 into dotnet:release/10.0.1xx Oct 23, 2025
10 checks passed
@akoeplinger
Copy link
Member

port to main?

@akoeplinger
Copy link
Member

/backport to main

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Started backporting to main (link to workflow run)

@github-actions github-actions bot mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants