Repository navigation
Promote MSBuild server out of Experimental namespace (#12099) - #13964
Conversation
|
The restore task requiring the taskhost workaround is ship blocking... It regresses performance. |
Move MSBuildClient, MSBuildClientExitType, MSBuildClientExitResult and OutOfProcServerNode from Microsoft.Build.Experimental to a new Microsoft.Build.Server namespace so the server can become a supported, non-experimental surface. Clean break (no obsolete shims): research found no external callers in dotnet/sdk, dotnet/roslyn, or the VS repo. Internal consumers (BuildManager, XMake, MSBuildClientApp) and unit tests updated. Added CP0001 package-validation suppressions for the removed Experimental types. VS-side ApiCompat suppressions must be coordinated on insertion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aa40eed to
c6b2e81
Compare
There was a problem hiding this comment.
Pull request overview
Promotes the MSBuild server public surface area out of Microsoft.Build.Experimental into a supported Microsoft.Build.Server namespace, and updates CLI, engine, tests, and docs accordingly.
Changes:
- Moved server-related public types (
MSBuildClient,MSBuildClientExitResult,MSBuildClientExitType,OutOfProcServerNode) toMicrosoft.Build.Server. - Updated internal call sites and unit tests to reference the new namespace.
- Updated package-validation suppressions and documentation for the namespace move.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/MSBuild/XMake.cs | Switched CLI usage/imports to Microsoft.Build.Server. |
| src/MSBuild/MSBuildClientApp.cs | Updated client app imports to Microsoft.Build.Server. |
| src/MSBuild.UnitTests/MSBuildServer_Tests.cs | Updated test imports to Microsoft.Build.Server. |
| src/Build/CompatibilitySuppressions.xml | Added CP0001 suppressions for removed Microsoft.Build.Experimental.* server types (note: see review comment about missing net10 suppressions). |
| src/Build/BackEnd/Node/OutOfProcServerNode.cs | Moved OutOfProcServerNode into Microsoft.Build.Server. |
| src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs | Updated XML doc cref to the new namespace. |
| src/Build/BackEnd/Client/MSBuildClientExitType.cs | Moved enum into Microsoft.Build.Server and improved doc comment. |
| src/Build/BackEnd/Client/MSBuildClientExitResult.cs | Moved type into Microsoft.Build.Server and updated summary text. |
| src/Build/BackEnd/Client/MSBuildClient.cs | Moved MSBuildClient into Microsoft.Build.Server. |
| src/Build/BackEnd/BuildManager/BuildManager.cs | Updated shutdown call to Microsoft.Build.Server.MSBuildClient. |
| src/Build.UnitTests/BackEnd/RedirectConsoleWriter_Tests.cs | Updated test imports to Microsoft.Build.Server. |
| src/Build.UnitTests/BackEnd/MSBuildClient_Tests.cs | Updated test imports to Microsoft.Build.Server. |
| documentation/MSBuild-Server.md | Documented the new public namespace for server entry points. |
Comments suppressed due to low confidence (1)
src/Build/CompatibilitySuppressions.xml:66
- Compatibility suppressions were added only for the net472 lib/ref assets. If package validation compares the net10.0 assets against the baseline as well, the removed
Microsoft.Build.Experimental.*server types will still trigger CP0001 forlib/net10.0andref/net10.0. The PR description also mentions 16 suppressions (including net10.0), but the file currently contains only 8.
</Suppression>
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
<Target>net10.0</Target>
</Suppression>
The suppressions were generated when the repo targeted net10.0. main has
since moved to net11.0, so package validation failed with unsuppressed
CP0001 errors for lib/net11.0 and ref/net11.0.
Regenerated from an empty baseline via ApiCompatGenerateSuppressionFile:
16 CP0001 entries (4 types x {lib,ref} x {net472,net11.0}). The stale
PKV006 net10.0 suppression is dropped since the baseline package
18.10.0-1.26378.2 already ships net11.0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1cbfd3fd-6e0a-41f7-8597-bd47632705dd
This suggests to me that maybe we shouldn't make it public at all? Rename the namespace but keep it internal? |
@rainersigwald that'd require Microsoft.Build.csproj InternalsVisibleTo MSBuild.csproj, which I don't have enough context about, but I thought it's intentionally not done so that API consumers can achieve all engine functionality without the cli itself. |
|
Ah, that's a good blocking function. We should update the comments to indicate that we don't expect third-party use of these APIs though--they basically only work to wrap the CLI so invoke the CLI instead. |
…y use Per PR feedback: these types are public only because MSBuild.exe lives in a separate assembly from Microsoft.Build with no InternalsVisibleTo between them. They only work to wrap the MSBuild CLI and offer nothing beyond it. - Mark MSBuildClient, MSBuildClientExitResult, MSBuildClientExitType, OutOfProcServerNode (and its nested BuildCallback delegate) with [EditorBrowsable(EditorBrowsableState.Never)] so they do not surface in IntelliSense. - Add <remarks> to each stating third-party use is not expected or supported and to invoke the CLI instead. - Note the same in documentation/MSBuild-Server.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1cbfd3fd-6e0a-41f7-8597-bd47632705dd
|
Done in 9a850b7. All four types (plus the nested
Also noted the same in |
Fixes #12099
Context
The MSBuild server public surface lived in
Microsoft.Build.Experimental. If the server is to become a supported, on-by-default feature, these types should not be in theExperimentalnamespace. This moves them to a new dedicatedMicrosoft.Build.Servernamespace.This mirrors the ProjectCache promotion (#12051), but as a clean break (no obsolete shim types) because — unlike ProjectCache, which had external plugin assemblies compiled against the old namespace — research found no external consumers of the server types:
Changes
Moved to
Microsoft.Build.Server:MSBuildClientMSBuildClientExitResultMSBuildClientExitTypeOutOfProcServerNode(incl. nested public delegateBuildCallback)Updated internal consumers and tests:
BuildManager.cs,NodeProviderOutOfProcBase.cs(doc cref),MSBuildClientApp.cs,XMake.csMSBuildClient_Tests.cs,RedirectConsoleWriter_Tests.cs,MSBuildServer_Tests.csCompatibility:
src/Build/CompatibilitySuppressions.xml: added 16CP0001suppressions (4 removed types × {lib,ref} × {net472,net11.0}), auto-generated viaApiCompatGenerateSuppressionFile, with a comment noting they can be removed once the package-validation baseline advances past this change. Package validation reported only type-levelCP0001(noCP0002), confirming no other public API references these types in its signature.Docs:
documentation/MSBuild-Server.md: noted that the public server entry points now live underMicrosoft.Build.Server.Breaking change
This is an intentional binary-breaking change to a previously
Experimentalsurface (a namespace rename within the same assembly cannot be type-forwarded). It should be noted in release/breaking-change notes. api-docs and source-build reference packages regenerate automatically from the shipped assembly.VS insertion coordination
The VS ApiCompat backward-compatibility test (
microsoft.build-suppressions.xml) treats the shipped public surface as a contract and will flag the removedMicrosoft.Build.Experimental.*server types. A matching VS-side suppressions update is required on insertion, mirroring how #12051 was coordinated.Testing
build.cmd: 0 warnings, 0 errors18.10.0-1.26378.2(regenerated fornet11.0after main moved offnet10.0)MSBuildClientunreachable-server fallback,RedirectConsoleWriter, and end-to-endCanShutdownServerProcess(real server start + shutdown via bothBuildManagerandMSBuildClient)Out of scope (separate work)
Microsoft.Build.Experimental.FileAccess/BuildCheck/ProjectCachesub-namespacesCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com