You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build fails when the .NET 11 CLI cannot connect to the MSBuild server during the restore of the compiler dependencies #156
The build fails with an error when PostSharp restores its compiler dependencies and the .NET 11 CLI cannot connect to its MSBuild server, although the restore itself succeeds:
PostSharp.targets(389,5): error : MSBuild server unavailable: could not connect to the server within the timeout window; the server may have failed to start. Falling back to an in-process build.
Observed
TeamCity build 340008 (Build Artifacts of postsharp/PostSharp, .NET SDK 11.0.100-rc.1.26425.128, Windows agent) failed with this error while building PostSharp.Patterns.Common. The Patterns solution builds with PostSharp, so it used the product under test.
The text is a resource of MSBuild.dll in the .NET 11 SDK. The CLI writes it to the standard error, then builds in-process.
ToolInvocationHelper.InvokeTool (Core/PostSharp.MSBuild/ToolInvocationHelper.cs) reports every line of the standard error of a child process as an MSBuild error, whatever the exit code of the process.
The same branch, on the same SDK, had built successfully in build 340000. The failure is intermittent.
Inferred, not measured
The line came from the dotnet restore that BuildTimeDependencyRestorer.RestoreDependencyProject runs for the compiler dependencies. It is the only dotnet invocation of the MSBuild task that runs MSBuild and reports the standard error as errors: the crossgen dotnet msbuild of NativeImageManager downgrades errors to messages, and NetCoreResolver runs --list-runtimes only.
The notice appears when the MSBuild server is slow to start, for example on a loaded build agent.
Expected
A restore that exits with code 0 does not fail the build. A notice on the standard error of dotnet is not an error.
To decide in the fix
Whether the exit code, rather than the standard error, decides the success of the restore, and at which severity the standard error is logged.
Whether the restore should run with the MSBuild server disabled (DOTNET_CLI_USE_MSBUILD_SERVER=0, MSBUILDUSESERVER=0). Otherwise, a build that has no server running starts one from PostSharp's task, and that server keeps running after the build.
Related: #92, which covers the validation of the MSBuild integration with the MSBuild server enabled by default.
Activity
gfraiteur commentedon Oct 8, 2026
Released in PostSharp 2027.0.3-preview.
-- Claude for Gael