Summary
HtmlReport rejects path-valued --report-html-filename arguments even though the HTML engine already writes through Path.Combine(outputDirectory, fileName). This makes HTML inconsistent with TRX and blocks report-path customization for the HTML reporter.
Evidence
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGeneratorCommandLine.cs:45-50
if (!IsValidPureFileName(fileName))
{
return ValidationResult.InvalidTask(ExtensionResources.HtmlReportFileNameShouldNotContainPath);
}
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportEngine.cs:65-70
string fileName = fileNameExplicitlyProvided
? providedFileName![0]
: BuildDefaultFileName(finishTime);
string outputDirectory = _configuration.GetTestResultDirectory();
string finalPath = Path.Combine(outputDirectory, fileName);
- For comparison,
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxCommandLine.cs:45-48 explicitly allows relative or absolute paths for --report-trx-filename.
Why this is a real issue
A command like --report-html --report-html-filename subdir\report.html fails validation today, while the analogous TRX scenario is supported. The HTML engine would already place a relative path under the results directory (and Path.Combine would also honor rooted paths), so the current restriction is a CLI-only inconsistency that blocks a concrete customization scenario.
Suggested resolution
Align --report-html-filename with TRX semantics:
- allow relative and absolute paths,
- sanitize/validate only the leaf file name,
- create missing intermediate directories before writing.
Related issues
Summary
HtmlReportrejects path-valued--report-html-filenamearguments even though the HTML engine already writes throughPath.Combine(outputDirectory, fileName). This makes HTML inconsistent with TRX and blocks report-path customization for the HTML reporter.Evidence
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGeneratorCommandLine.cs:45-50src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportEngine.cs:65-70src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxCommandLine.cs:45-48explicitly allows relative or absolute paths for--report-trx-filename.Why this is a real issue
A command like
--report-html --report-html-filename subdir\report.htmlfails validation today, while the analogous TRX scenario is supported. The HTML engine would already place a relative path under the results directory (andPath.Combinewould also honor rooted paths), so the current restriction is a CLI-only inconsistency that blocks a concrete customization scenario.Suggested resolution
Align
--report-html-filenamewith TRX semantics:Related issues
Microsoft.Testing.Extensions.TrxReportshould allow customizingtrxfile name via dedicatedMSBuildproperty #6648