Skip to content

[MTP] Result files not added to results directory #6782

@cbersch

Description

@cbersch

Describe the bug

Result files added with TestContext.AddResultFile are not saved in the results directory and are referenced by an absolute path when running with MTP.

Using

  • .NET 10 RC 2
  • MSTest version 4.0.1
  • Microsoft.Testing.Extensions.TrxReport version 2.0.1

Steps To Reproduce

  1. Use project from mtp_attachment.zip
  2. Run with dotnet test --project .\MyProject.csproj -p:UseMtp=true --results-directory=Foobar --report-trx

Expected behavior

  • Result files are copied to results directory Foobar.
  • Results directory is self-contained.

Actual behavior

Output:

Running tests from bin\Debug\net10.0\MyProject.dll (net10.0|x64)
bin\Debug\net10.0\MyProject.dll (net10.0|x64) passed (346ms)

  In process file artifacts produced:
    - For test 'TestMethod': bin\Debug\net10.0\TestOutput.txt
    - Foobar\somesecretstuff_2025-10-22_10_55_59.8701947.trx

Test run summary: Passed!
  total: 1
  failed: 0
  succeeded: 1
  skipped: 0
  duration: 928ms

And the trx file contains

<ResultFiles>
    <ResultFile path="C:\Temp\mtp_attachment\bin\Debug\net10.0\TestOutput.txt" />
</ResultFiles>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions