Skip to content

Reference Microsoft.NETCore.App in repos which are downstream of runtime - #5187

Merged
ericstj merged 5 commits into
dotnet:mainfrom
ericstj:fixSourceBuildLatestRuntime
Mar 5, 2026
Merged

ericstj merged 5 commits into
dotnet:mainfrom
ericstj:fixSourceBuildLatestRuntime

Conversation

@ericstj

@ericstj ericstj commented Mar 3, 2026

Copy link
Copy Markdown
Member

Retry #4801

Address dotnet/source-build#5502 (comment)

Testing internally with https://dev.azure.com/dnceng/internal/_build/results?buildId=2916776&view=results

Will iterate on internal build pipeline to ensure this doesn't break official build.

Copilot AI review requested due to automatic review settings March 3, 2026 03:02
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team March 3, 2026 03:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates several VMR downstream repos to compile against the “live” Microsoft.NETCore.App.Ref targeting pack during source-build, aligning their framework reference pack resolution with the runtime being built in the VMR.

Changes:

  • Add Microsoft.NETCore.App.Ref as a dependency (and flow its version via MicrosoftNETCoreAppRefPackageVersion) in multiple downstream repos.
  • In source-build (DotNetBuildSourceOnly=true), set Arcade “Known*” targeting pack properties to point at MicrosoftNETCore.App.Ref’s version so the SDK resolves the intended targeting/runtime packs.
  • Adjust several Roslyn build-time tool projects to disable known-pack version updates (so they aren’t affected by the source-build targeting pack version override).

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/vstest/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build targeting pack alignment.
src/vstest/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/vstest/Directory.Build.props Sets source-build KnownFrameworkReference*/KnownCrossgen2Pack* properties to the live ref-pack version.
src/templating/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/templating/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/templating/Directory.Build.props Configures source-build targeting pack “Known*” versions using the live ref-pack version.
src/sourcelink/src/Directory.Build.props Configures source-build targeting pack “Known*” versions using the live ref-pack version.
src/sourcelink/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/sourcelink/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/roslyn/src/Tools/GenerateRulesMissingDocumentation/GenerateRulesMissingDocumentation.csproj Disables known-pack version updates for this build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateDocumentationAndConfigFilesForBrokenRuntime/GenerateDocumentationAndConfigFilesForBrokenRuntime.csproj Disables known-pack version updates for this build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj Disables known-pack version updates for this build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateAnalyzerNuspec/GenerateAnalyzerNuspec.csproj Disables known-pack version updates for this build-time tool.
src/roslyn/src/CodeStyle/Tools/CodeStyleConfigFileGenerator.csproj Disables known-pack version updates for this build-time tool.
src/roslyn/eng/targets/Imports.BeforeArcade.targets Sets source-build KnownFrameworkReference*/KnownCrossgen2Pack* properties to the live ref-pack version.
src/roslyn/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/roslyn/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/razor/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/razor/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/razor/Directory.Build.props Configures source-build targeting pack “Known*” versions using the live ref-pack version.
src/nuget-client/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/nuget-client/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/nuget-client/Directory.Build.props Configures source-build targeting pack “Known*” versions using the live ref-pack version.
src/msbuild/eng/Version.Details.xml Adds Microsoft.NETCore.App.Ref dependency for source-build.
src/msbuild/eng/Version.Details.props Introduces MicrosoftNETCoreAppRefPackageVersion / MicrosoftNETCoreAppRefVersion properties.
src/msbuild/Directory.Build.props Configures source-build targeting pack “Known*” versions using the live ref-pack version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ViktorHofer

Copy link
Copy Markdown
Member

I think this will break the existing repo source build jobs. The tooling repos target net10.0 in repo source build as they use Arcade 10 which sets NetCurrent to net10.0.

Using live packs is a product build concept only. Also, these repos don't consume build dependencies from the VMR so the added Version.Details entries will never get updated.

That leads me to think that this is truely a VMR only concept and should be handled there.

@ericstj

ericstj commented Mar 3, 2026

Copy link
Copy Markdown
Member Author

Testing internally with https://dev.azure.com/dnceng/internal/_build/results?buildId=2916776&view=results

It looks like this completed successfully, modulo some build flakiness which looks a bit like out-of-disk space on a single job.

The tooling repos target net10.0 in repo source build as they use Arcade 10 which sets NetCurrent to net10.0.
That leads me to think that this is truely a VMR only concept and should be handled there.

I see - in that case I would remove the D.B.props changes but keep the Version changes, then uncomment the global properties in the VMR project? Tooling repos can always decide to add these properties to their own D.B.props if they see a backflow change that requires it.

@ViktorHofer

Copy link
Copy Markdown
Member

Yes that sounds like the right path forward.

I would also revert the Version.Details changes as they will be stale and don't match versions from other runtime dependencies in Version.Details.

@ericstj

ericstj commented Mar 3, 2026 •

Copy link
Copy Markdown
Member Author

I would also revert the Version.Details changes as they will be stale and don't match versions from other runtime dependencies in Version.Details.

Doesn't VMR source build require these entries in order to flow the package properties (thus all those comments about being required for source-build). My expectation was we add them once then they get fixed up after first flow.

I see what you mean - this is using _DependencyProducedPackage which is all the package outputs, not just those that happen to be subscribed.

@ericstj
ericstj force-pushed the fixSourceBuildLatestRuntime branch from 9a84c65 to 7384d29 Compare March 3, 2026 22:40
@ericstj
ericstj requested review from a team as code owners March 3, 2026 22:40
@ericstj

ericstj commented Mar 3, 2026 •

Copy link
Copy Markdown
Member Author

All right using that approach. Test build is https://dev.azure.com/dnceng/internal/_build/results?buildId=2917634&view=results.

Note to approvers -- do not merge until the linked build is also green. build is green ✅

@ViktorHofer

Copy link
Copy Markdown
Member

I see what you mean - this is using _DependencyProducedPackage which is all the package outputs, not just those that happen to be subscribed.

Similarly to P2Ps it holds the outputs from direct and transitive repository references.

Comment thread repo-projects/Directory.Build.targets Resolved
Comment thread repo-projects/Directory.Build.targets Resolved
@ericstj

ericstj commented Mar 4, 2026

Copy link
Copy Markdown
Member Author

Looks like our internal build passed, so this should avoid the previous regression here. Thanks for your help @ViktorHofer -- I updated the comments.

@ericstj
ericstj enabled auto-merge (squash) March 4, 2026 19:48
@ericstj
ericstj disabled auto-merge March 4, 2026 20:38
@ericstj

ericstj commented Mar 4, 2026 •

Copy link
Copy Markdown
Member Author

I'm now skeptical if this is working. I am hitting a similar failure as before in roslyn in source build -- https://dev.azure.com/dnceng-public/public/_build/results?buildId=1319208&view=logs&j=f8361ec4-8613-5f7f-2f10-d7dd7654e93f&t=f0818e4f-8d19-558f-794d-f0f07fd49e52
Seems to me like it's using new packages without new targeting pack.

Binlog shows values not set --

property:KnownFrameworkReferenceMicrosoftNETCoreAppCurrentTargetingPackVersion= --property:KnownFrameworkReferenceMicrosoftNETCoreAppCurrentDefaultRuntimeFrameworkVersion= --property:KnownFrameworkReferenceMicrosoftNETCoreAppCurrentLatestRuntimeFrameworkVersion= --property:KnownRuntimePackMicrosoftNETCoreAppCurrentMonoLatestRuntimeFrameworkVersion= --property:KnownRuntimePackMicrosoftNETCoreAppCurrentNativeAOTLatestRuntimeFrameworkVersion= 

Comment thread repo-projects/Directory.Build.targets Resolved
@ericstj

ericstj commented Mar 5, 2026 •

Copy link
Copy Markdown
Member Author

Ok, need a new official build test for this. https://dev.azure.com/dnceng/internal/_build/results?buildId=2918850&view=results

I'd also like to see #5206 make it past the roslyn failures around using the old targeting pack.

NO MERGE until those happen.

@ericstj ericstj added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 5, 2026
@ericstj

ericstj commented Mar 5, 2026

Copy link
Copy Markdown
Member Author

Official build failing with:

[xUnit.net 00:02:18.25]     Microsoft.DotNet.SourceBuild.Tests.SourcelinkTests.VerifySourcelinks [FAIL]
[xUnit.net 00:02:18.25]       Assert.True() Failure
[xUnit.net 00:02:18.25]       Expected: True
[xUnit.net 00:02:18.25]       Actual:   False
[xUnit.net 00:02:18.25]       Stack Trace:
[xUnit.net 00:02:18.25]         /_/test/Microsoft.DotNet.SourceBuild.Tests/SourcelinkTests.cs(68,0): at Microsoft.DotNet.SourceBuild.Tests.SourcelinkTests.VerifySourcelinks()
[xUnit.net 00:02:18.25]            at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
[xUnit.net 00:02:18.25]            at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[xUnit.net 00:02:18.25]       Output:
[xUnit.net 00:02:18.25]         Executing: tar xzf /__w/1/s/artifacts/assets/Release/dotnet-symbols-all-11.0.100-preview.3.26154.118-centos.10-x64.tar.gz -C /__w/1/s/artifacts/bin/Microsoft.DotNet.SourceBuild.Tests/Release/SourcelinkTests/symbols
[xUnit.net 00:02:18.25]         Sourcelink verification failed for the following files:
[xUnit.net 00:02:18.25]         /__w/1/s/artifacts/bin/Microsoft.DotNet.SourceBuild.Tests/Release/SourcelinkTests/symbols/runtime/obj/System.Composition.Convention/Release/net11.0/System.Composition.Convention.pdb

Given the isolated and disconnected failure, I think it might be flaky. Rerunning.

#5206 made it through phase1 so I think this change is good from a completeness perspective.

@ericstj

ericstj commented Mar 5, 2026

Copy link
Copy Markdown
Member Author

Given the isolated and disconnected failure, I think it might be flaky. Rerunning.

Indeed it was. Passed on rerun. Will file an issue.

@ericstj
ericstj merged commit e122ae5 into dotnet:main Mar 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants