Skip to content

Flaky: RunFileTests_* (file-based program build) intermittently fail with MSB4025 'project file could not be loaded' #54813

Description

@Evangelink

Summary

The Microsoft.DotNet.Cli.Run.Tests.RunFileTests_* tests (file-based program / dotnet run & dotnet build <file>.cs) fail intermittently in CI. They are not associated with any particular PR — they fail across unrelated PR merge builds and on otherwise-clean changes.

Affected tests (non-exhaustive)

  • RunFileTests_BuildCommands.Build_Library_MultiTarget
  • RunFileTests_BuildCommands.Build_Exe_MultiTarget
  • RunFileTests_BuildCommands.Pack / Pack_CustomPath
  • RunFileTests_BuildCommands.NoBuild_02
  • RunFileTests_CscOnlyAndApi.MSBuildGet_Consistent

Symptom

The generated file-based-program project is restored and then immediately reported missing:

<tmp>/Build_Library---XXXX/lib.cs.csproj : error MSB4025: The project file could not be loaded. Could not find file '<tmp>/Build_Library---XXXX/lib.cs.csproj'.

i.e. a race between generating/restoring the implicit *.cs.csproj and loading it (also seen as No such file or directory for the generated program, MSB4104). The failures are non-deterministic and clear on re-run.

Impact

This is currently the dominant source of red CI on the MSTest-migration PR series and on unrelated PRs (observed in the majority of recent PR builds).

Known issue error message

{
  "ErrorMessage": "Microsoft.DotNet.Cli.Run.Tests.RunFileTests",
  "BuildRetry": false
}

Known issue validation

Build: 🔎
Result validation: ⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.
Validation performed at: 6/17/2026 11:43:32 AM UTC

Activity

  1. jjonescz commented on Jun 17, 2026

    @jjonescz
    Member

    Can you link at least one run with this error so I can take a look? Or even better, fill in the error pattern so build analysis can link builds automatically.

  2. Evangelink commented on Jun 17, 2026

    @Evangelink
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-run-fileItems related to the "dotnet run <file>" effort

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions