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
Add a new command-line option, --report-trx-file-prefix. Only one of --report-trx-filename and --report-trx-file-prefix can be used at the same time.
But placeholders can be more flexible.
Reacted by Amaury Levé, viktorgobbi and Will Rogers
<target_framework> isn't super trivial. It doesn't seem easy (or possible at all?) to know net9.0 vs net9.0-windows for example. I don't want us to introduce something that's not accurate.
Maybe instead, we can expose <target_framework_identifier> (.NETFramework, .NETCoreApp, etc). And <target_framework_version>.
In that case, yes it will be the same for net9.0 and net9.0-windows, but that's what we expose and what the names refer to.
We already have some code that translates the TFM to short names, and this would be a good adition there, so we don't have to show .NETCoreApp,Version=7.0.0 to users, or whatever horrible name is in the framework identifier.
Suggestion to further improve this, to choose the shortest names for the most used properties:
tfm -> net9.0
timestamp -> date + time with seconds accuracy in sortable format 2025-05-23T17-45-56
id / rng -> short random id like f0fJf that is just enough to guarantee that we don't get the conflict on seconds / minutes
assembly / project -> project name -> ContonsoTests
pid -> process id
date -> just date in sortable format
time -> just time in sortable format
repo_root -> place where there is .git or .sln ?
etc.
and then some other longer replacements: guid, precise_time, long_tfm based on the needs that we discover.
Also we should document when and where we take the values from, e.g. if we would rely on current folder, we should resolve it before the run and document that, to avoid leaving it after the run when tests can change the current folder etc.
I'd strongly encourage you to not do MSBuild-style placeholders - we don't expose MSBuild stuff anywhere else on the CLI directly. There is a small amount of prior art for the -bl flag in MSbuild - it accepts {} in the name and will expand it with the current timestamp formatted in a lexically-sortable way.
Bumping the issue to reiterate the need for the customisation. Running dotnet test <name>.sln -- --results-directory "$(path)\TestsResults" --report-trx --report-trx-filename test_results.trx results in a trx from the last tested project, all others stomped over...
Activity
Youssef1313 commentedon Apr 3, 2025
<target_framework>isn't super trivial. It doesn't seem easy (or possible at all?) to knownet9.0vsnet9.0-windowsfor example. I don't want us to introduce something that's not accurate.Maybe instead, we can expose
<target_framework_identifier>(.NETFramework, .NETCoreApp, etc). And<target_framework_version>.In that case, yes it will be the same for net9.0 and net9.0-windows, but that's what we expose and what the names refer to.
nohwnd commentedon Apr 4, 2025
these two assembly level attributes have that info:
[assembly: TargetPlatform("Windows10.0.26100.0")]
[assembly: SupportedOSPlatform("Windows10.0.26100.0")]
When the value is Windows7.0 or 8.0, that is the -windows value. Otherwise the exact version is used.
The mapping is defined here: https://github.com/dotnet/sdk/blob/main/src/Layout/redist/targets/GenerateBundledVersions.targets#L1313-L1337
We already have some code that translates the TFM to short names, and this would be a good adition there, so we don't have to show .NETCoreApp,Version=7.0.0 to users, or whatever horrible name is in the framework identifier.
nohwnd commentedon Apr 4, 2025
https://github.com/microsoft/testfx/blob/main/src/Platform/Microsoft.Testing.Platform/OutputDevice/TargetFrameworkParser.cs this is the code to show nice short names
nohwnd commentedon May 23, 2025
Suggestion to further improve this, to choose the shortest names for the most used properties:
tfm -> net9.0
timestamp -> date + time with seconds accuracy in sortable format 2025-05-23T17-45-56
id / rng -> short random id like f0fJf that is just enough to guarantee that we don't get the conflict on seconds / minutes
assembly / project -> project name -> ContonsoTests
pid -> process id
date -> just date in sortable format
time -> just time in sortable format
repo_root -> place where there is .git or .sln ?
etc.
and then some other longer replacements: guid, precise_time, long_tfm based on the needs that we discover.
Also we should document when and where we take the values from, e.g. if we would rely on current folder, we should resolve it before the run and document that, to avoid leaving it after the run when tests can change the current folder etc.
Evangelink commentedon Jul 15, 2025
Relates to #4130 for the format of placeholders.
Browsing the most common patterns in .NET, it seems we have:
$(Variable)like MSBuild$var$like templating engines (VS and dotnet)${var}like most shellChet Husk (@baronfel) with your experience in SDK and your broad view over the products, is there a pattern you would recommend?
baronfel commentedon Jul 15, 2025
I'd strongly encourage you to not do MSBuild-style placeholders - we don't expose MSBuild stuff anywhere else on the CLI directly. There is a small amount of prior art for the
-blflag in MSbuild - it accepts{}in the name and will expand it with the current timestamp formatted in a lexically-sortable way.RussKie commentedon Mar 25, 2026
Bumping the issue to reiterate the need for the customisation. Running
dotnet test <name>.sln -- --results-directory "$(path)\TestsResults" --report-trx --report-trx-filename test_results.trxresults in a trx from the last tested project, all others stomped over...