From 910e1b3af5a2053b6b3833f8b051ff0c335cf4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Provazn=C3=ADk?= Date: Mon, 22 Jun 2026 11:33:58 +0200 Subject: [PATCH 1/5] [vs17.14] Redistribute net472 dotnet/runtime 10.0.8 servicing wave (Nrbf + HashCode 6.0) Redistribute the net472 dotnet/runtime 10.0.8 servicing wave to line up with the corresponding VS servicing event, without changing what MSBuild compiles or declares against. net472 downloads the 10.0.8 packages and swaps the copy-local assemblies into the application output after RAR, with matching binding redirects. - eng/Versions.props: introduce RuntimePackageVersion_CompileTime (9.0.0) and RuntimePackageVersion_VSDeploy (10.0.8); document the compile-vs-deploy split. - src/Directory.Build.targets: add ReplaceRuntimeAssembliesWithServicingVersions target gated on DeployRuntimeServicingAssemblies for net472. - src/MSBuild/MSBuild.csproj, src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj: opt in via DeployRuntimeServicingAssemblies. - src/MSBuild/app.config and app.amd64.config: binding redirects to the deployed assembly versions (10.0.0.8, Microsoft.Bcl.HashCode 6.0.0.0, System.Memory 4.0.5.0, System.Runtime.CompilerServices.Unsafe 6.0.3.0, System.Threading.Tasks.Extensions 4.2.4.0, System.Buffers 4.0.5.0, System.Numerics.Vectors 4.1.6.0). - src/Tasks/System.Resources.Extensions.pkgdef: redirect 10.0.0.3 -> 10.0.0.8. Ports internal PR DevDiv/DotNet-msbuild-Trusted!751025. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/Versions.props | 63 +++++++--- src/Directory.Build.targets | 112 ++++++++++++++++++ .../MSBuild.Bootstrap.csproj | 6 + src/MSBuild/MSBuild.csproj | 6 + src/MSBuild/app.amd64.config | 77 ++++++------ src/MSBuild/app.config | 42 ++++--- src/Tasks/System.Resources.Extensions.pkgdef | 4 +- 7 files changed, 239 insertions(+), 71 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4c2f37cec53..8f3e17e95d0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,12 +2,12 @@ - 17.14.50 + 17.14.51 release 17.13.9 15.1.0.0 servicing - test true @@ -31,6 +31,18 @@ As a result, we CONTINUE TO REFERENCE the old versions at build time, so those are the versions that get embedded into MSBuild assemblies. However, we can update, binding-redirect to, and distribute the newest version (that matches the VS-referenced versions) in order to get the benefits of updating. See uses of $(UseFrozenMaintenancePackageVersions) for details. + + These referenced versions are deliberately NOT bumped to the servicing build that the + net472 runtime wave ($(RuntimePackageVersion_VSDeploy)) was produced against: doing so + would change what the .NET (Core) build references and pull in new source-build prebuilts. + Instead, net472 redistributes the newer maintenance assemblies through the same + $(DeployRuntimeServicingAssemblies) swap as the runtime packages (see + src/Directory.Build.targets). Because their assembly versions move between servicing + builds, the matching redirects in src/MSBuild/app.config and app.amd64.config point at the + deployed assembly versions: System.Memory 4.6.3 -> 4.0.5.0, + System.Runtime.CompilerServices.Unsafe 6.1.2 -> 6.0.3.0, + System.Threading.Tasks.Extensions 4.6.3 -> 4.2.4.0, and the transitively redistributed + System.Buffers 4.6.1 -> 4.0.5.0 and System.Numerics.Vectors 4.6.1 -> 4.1.6.0. --> 4.6.0 4.6.0 @@ -41,20 +53,39 @@ - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 - 9.0.0 + + 9.0.0 + 10.0.8 + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) + $(RuntimePackageVersion_CompileTime) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index deba5dbaf7a..15ea323fa9f 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -184,6 +184,118 @@ + + + + <_DeployedRuntimeAssembly Include="System.Collections.Immutable;System.Configuration.ConfigurationManager;System.Diagnostics.DiagnosticSource;System.Diagnostics.EventLog;System.Formats.Asn1;System.Formats.Nrbf;System.Reflection.Metadata;System.Reflection.MetadataLoadContext;System.Resources.Extensions;System.Security.Cryptography.ProtectedData;System.Text.Encoding.CodePages;System.Text.Json;System.Threading.Channels;System.Threading.Tasks.Dataflow"> + $(RuntimePackageVersion_VSDeploy) + + + <_DeployedRuntimeAssembly Include="System.IO.Pipelines;System.Text.Encodings.Web;Microsoft.Bcl.AsyncInterfaces"> + $(RuntimePackageVersion_VSDeploy) + + + <_DeployedRuntimeAssembly Include="System.Memory"> + 4.6.3 + + <_DeployedRuntimeAssembly Include="System.Runtime.CompilerServices.Unsafe"> + 6.1.2 + + <_DeployedRuntimeAssembly Include="System.Threading.Tasks.Extensions"> + 4.6.3 + + <_DeployedRuntimeAssembly Include="System.Buffers"> + 4.6.1 + + <_DeployedRuntimeAssembly Include="System.Numerics.Vectors"> + 4.6.1 + + + <_DeployedRuntimeAssembly Include="Microsoft.Bcl.HashCode"> + 6.0.0 + + + + + + + + + + $(MSBuildWarningsAsMessages);MSB3277 + + + + + + + <_DeployedRuntimeAssemblyIds>;@(_DeployedRuntimeAssembly); + + <_RuntimeCopyLocalIds>;@(ReferenceCopyLocalPaths->'%(NuGetPackageId)'); + + + + <_DeployedRuntimeAssembly> + $(NuGetPackageRoot)$([System.String]::Copy('%(Identity)').ToLowerInvariant())\%(Version)\lib\net462\%(Identity).dll + + + + + + + + + %(_DeployedRuntimeAssembly.Identity) + %(_DeployedRuntimeAssembly.Version) + + + + diff --git a/src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj b/src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj index 4839c0dcbfa..5d4c0aab3d8 100644 --- a/src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj +++ b/src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj @@ -12,6 +12,12 @@ false + + + true diff --git a/src/MSBuild/MSBuild.csproj b/src/MSBuild/MSBuild.csproj index 2edca8c339b..b7f96ae2a80 100644 --- a/src/MSBuild/MSBuild.csproj +++ b/src/MSBuild/MSBuild.csproj @@ -40,6 +40,12 @@ redirect ValueTuple _down_ to match VS. --> false + + true + true contentFiles contentFiles\any\ diff --git a/src/MSBuild/app.amd64.config b/src/MSBuild/app.amd64.config index 528707c3e22..a99052db34d 100644 --- a/src/MSBuild/app.amd64.config +++ b/src/MSBuild/app.amd64.config @@ -70,13 +70,13 @@ - - + + - - + + @@ -94,30 +94,30 @@ - - + + - - + + - - + + - - + + - - + + @@ -190,58 +190,63 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + - - + + diff --git a/src/MSBuild/app.config b/src/MSBuild/app.config index cd0059bd3db..5c8aad7237f 100644 --- a/src/MSBuild/app.config +++ b/src/MSBuild/app.config @@ -33,11 +33,11 @@ - + - + @@ -57,64 +57,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + diff --git a/src/Tasks/System.Resources.Extensions.pkgdef b/src/Tasks/System.Resources.Extensions.pkgdef index 4e811b44871..c7b0c4cb4f8 100644 --- a/src/Tasks/System.Resources.Extensions.pkgdef +++ b/src/Tasks/System.Resources.Extensions.pkgdef @@ -3,5 +3,5 @@ "codeBase"="$BaseInstallDir$\MSBuild\Current\Bin\System.Resources.Extensions.dll" "publicKeyToken"="cc7b13ffcd2ddd51" "culture"="neutral" -"oldVersion"="0.0.0.0-9.0.0.0" -"newVersion"="9.0.0.0" +"oldVersion"="0.0.0.0-10.0.0.8" +"newVersion"="10.0.0.8" From 5e4d30c0eeb4485890f1f669f561acbf157d7b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Provazn=C3=ADk?= Date: Mon, 22 Jun 2026 17:14:36 +0200 Subject: [PATCH 2/5] Fix net472 out-of-proc tests crashing on servicing binding-redirect skew Test projects that re-bundle MSBuild.exe (via ProjectReference to MSBuild.csproj) copy the servicing MSBuild.exe.config but resolve their own copy-local runtime assemblies at the compiled-against versions. The redirects then point at servicing versions (e.g. System.Memory 4.0.5.0) while the on-disk assembly is the compiled-against one (4.0.2.0), so the copied MSBuild.exe fails to start with a TypeInitializationException/FileLoadException. This broke every net472 out-of-proc test and hung tests waiting on a spawned node/server until the CI timeout. Add an AfterTargets="Build" target (net472, non-deploy projects only) that realigns the copied MSBuild.exe.config binding redirects to the runtime assemblies actually present next to it, keeping those bins self-consistent at the compiled-against versions. Deploy surfaces (MSBuild.exe, bootstrap) are excluded since their output already is the servicing build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Directory.Build.targets | 100 ++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 15ea323fa9f..cc3c3579206 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -296,6 +296,106 @@ + + + + + + + + + + + + + <_CopiedMSBuildExeConfig Include="$(TargetDir)**\MSBuild.exe.config" /> + + + + From e68114a799d58c8500926415e323e6990bbd0ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Provazn=C3=ADk?= Date: Mon, 22 Jun 2026 18:13:05 +0200 Subject: [PATCH 3/5] Scope MSBuild.exe.config realign to test projects via opt-in Previously the realign target ran for any net472 project without DeployRuntimeServicingAssemblies, which also matched non-test projects that bundle MSBuild.exe for shipping (e.g. the VS.ExternalAPIs.MSBuild / DevDivPackage insertion package). It was harmless today only because that nuspec does not ship MSBuild.exe.config. Make it an explicit opt-in ($(RealignBundledMSBuildExeConfig)) defaulted on only for $(IsTestProject) == 'true', so the copied config is realigned exclusively in test bins and shipping/insertion projects are never touched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Directory.Build.targets | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index cc3c3579206..21da642aa57 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -299,19 +299,29 @@ + + true + + @@ -388,7 +398,7 @@ + Condition="'$(TargetFramework)' == 'net472' and '$(RealignBundledMSBuildExeConfig)' == 'true'"> <_CopiedMSBuildExeConfig Include="$(TargetDir)**\MSBuild.exe.config" /> From 71bcd226ef65def355d8e633027adc88bd9c29cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Provazn=C3=ADk?= Date: Mon, 22 Jun 2026 18:34:26 +0200 Subject: [PATCH 4/5] Pin net472 test projects to servicing assemblies instead of rewriting exe.config Replace the previous approach (rewriting the bundled MSBuild.exe.config binding redirects down to the compiled-against versions) with deploying the servicing assemblies into the test bins, as preferred in review. Test projects that bundle MSBuild.exe and spawn it out-of-proc (Engine, CommandLine, Tasks, Utilities UnitTests) now set DeployRuntimeServicingAssemblies=true, just like MSBuild.csproj and the bootstrap. Their net472 output then carries the servicing runtime assemblies that the copied servicing app.config binding redirects point at, so the bundled MSBuild.exe starts correctly instead of failing with a FileLoadException. Removes the AlignBindingRedirectsToOutputAssemblies task/target added previously. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Microsoft.Build.Engine.UnitTests.csproj | 8 ++ src/Directory.Build.targets | 110 ------------------ ...crosoft.Build.CommandLine.UnitTests.csproj | 7 ++ .../Microsoft.Build.Tasks.UnitTests.csproj | 7 ++ ...Microsoft.Build.Utilities.UnitTests.csproj | 7 ++ 5 files changed, 29 insertions(+), 110 deletions(-) diff --git a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj index db6518f967b..5c878921dea 100644 --- a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj +++ b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj @@ -4,6 +4,14 @@ $(RuntimeOutputTargetFrameworks) $(RuntimeOutputPlatformTarget) false + + + true + Microsoft.Build.Engine.UnitTests $(DefineConstants);MICROSOFT_BUILD_ENGINE_UNITTESTS diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 21da642aa57..15ea323fa9f 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -296,116 +296,6 @@ - - - true - - - - - - - - - - - - - - <_CopiedMSBuildExeConfig Include="$(TargetDir)**\MSBuild.exe.config" /> - - - - diff --git a/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj b/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj index b54e07f48fe..47cb49440d9 100644 --- a/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj +++ b/src/MSBuild.UnitTests/Microsoft.Build.CommandLine.UnitTests.csproj @@ -4,6 +4,13 @@ $(RuntimeOutputTargetFrameworks) $(RuntimeOutputPlatformTarget) false + + + true diff --git a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj index 2ff059b2833..01b089e36e7 100644 --- a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj +++ b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj @@ -6,6 +6,13 @@ false false + + true + Microsoft.Build.Tasks.UnitTests true $(DefineConstants);MICROSOFT_BUILD_TASKS_UNITTESTS diff --git a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj index cdc831de205..99e963f7223 100644 --- a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj +++ b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj @@ -6,6 +6,13 @@ Microsoft.Build.Utilities.UnitTests true Microsoft.Build.Utilities.UnitTests + + + true From b7b9e95866fc7e511dcf37a92dcc1d1010856a66 Mon Sep 17 00:00:00 2001 From: Rainer Sigwald Date: Mon, 22 Jun 2026 20:25:41 -0500 Subject: [PATCH 5/5] Centralize runtime version selection in Directory.Build.targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/Versions.props | 19 +++----- .../Microsoft.Build.Engine.UnitTests.csproj | 8 ---- src/Directory.Build.targets | 44 +++++++++++++++++++ ...crosoft.Build.CommandLine.UnitTests.csproj | 7 --- .../Microsoft.Build.Tasks.UnitTests.csproj | 7 --- ...Microsoft.Build.Utilities.UnitTests.csproj | 7 --- 6 files changed, 49 insertions(+), 43 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 8f3e17e95d0..c2490ab70bd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -69,23 +69,14 @@ See the ReplaceRuntimeAssembliesWithServicingVersions target in src/Directory.Build.targets. This mirrors the $(UseFrozenMaintenancePackageVersions) mechanism in reverse (there we compile against an older build than we ship; here we ship a newer build than we compile). + + These two versions are the single source of truth. src/Directory.Build.targets selects between + them per project and assigns the individual System.* runtime package versions from the result; + the selection lives there because it depends on $(IsUnitTestProject) and $(TargetFramework), + which are not yet set this early. --> 9.0.0 10.0.8 - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) - $(RuntimePackageVersion_CompileTime) diff --git a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj index 5c878921dea..db6518f967b 100644 --- a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj +++ b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj @@ -4,14 +4,6 @@ $(RuntimeOutputTargetFrameworks) $(RuntimeOutputPlatformTarget) false - - - true - Microsoft.Build.Engine.UnitTests $(DefineConstants);MICROSOFT_BUILD_ENGINE_UNITTESTS diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 15ea323fa9f..74c8b54bf25 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -158,6 +158,50 @@ + + + $(RuntimePackageVersion_VSDeploy) + $(RuntimePackageVersion_CompileTime) + + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + $(RuntimePackageVersion) + + + + + 4.6.3 + 4.6.3 + 6.1.2 + + $(RuntimeOutputTargetFrameworks) $(RuntimeOutputPlatformTarget) false - - - true diff --git a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj index 01b089e36e7..2ff059b2833 100644 --- a/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj +++ b/src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj @@ -6,13 +6,6 @@ false false - - true - Microsoft.Build.Tasks.UnitTests true $(DefineConstants);MICROSOFT_BUILD_TASKS_UNITTESTS diff --git a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj index 99e963f7223..cdc831de205 100644 --- a/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj +++ b/src/Utilities.UnitTests/Microsoft.Build.Utilities.UnitTests.csproj @@ -6,13 +6,6 @@ Microsoft.Build.Utilities.UnitTests true Microsoft.Build.Utilities.UnitTests - - - true