Fix MSBuild import consistency findings (#9761)#9830
Conversation
- VideoRecorder buildTransitive: use the standard build/<tfm> forwarding pattern used by all other extensions (resolves to the same buildMultiTargeting content). - Platform.MSBuild buildMultiTargeting: prefix CustomTestTarget import with $(MSBuildThisFileDirectory) for consistency with the adjacent import. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Standardizes two MSBuild imports without changing behavior.
Changes:
- Aligns VideoRecorder’s transitive forwarding with other extensions.
- Makes the custom test-target import path explicit.
Show a summary per file
| File | Description |
|---|---|
Microsoft.Testing.Platform.MSBuild.targets |
Prefixes the custom target import with its file directory. |
Microsoft.Testing.Extensions.VideoRecorder.props |
Uses the standard TFM-specific forwarding path. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
There was a problem hiding this comment.
🤖 This review was generated by Copilot from workflow run #29104665282.
Summary: Non-functional consistency fixes to MSBuild import paths. Both changes are correct and low-risk.
✅ Microsoft.Testing.Platform.MSBuild.targets (Rule D-1): Adding $(MSBuildThisFileDirectory) prefix is a safe consistency improvement. MSBuild resolves bare relative imports against the importing file's directory anyway, so this is purely cosmetic alignment with the adjacent VSTest.targets import on line 314.
✅ VideoRecorder buildTransitive props (Rule E-1): The TFM-extraction pattern ($([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName(...))))) is the same forwarding idiom used by the other 13 extensions. The double backslash (\\) after the extracted TFM folder name is intentional — MSBuild property functions need the escape. The resolved path (build/<tfm>/Microsoft.Testing.Extensions.VideoRecorder.props) ultimately chains back to the same buildMultiTargeting content, so behavior is unchanged.
No concerns — LGTM.
🔴 Build Failure AnalysisRoot CauseThe build failure is not caused by this PR's changes. This PR only modifies MSBuild import paths in Errors (4 instances, 1 root cause)
The Suggested Fix (on the base branch)Add #pragma warning disable CA1416 // Platform compatibility - implementing interface method
public Task RunLongRunning(Func<Task> action, string name, CancellationToken cancellationToken)
=> _inner.RunLongRunning(action, name, cancellationToken);
#pragma warning restore CA1416Or, alternatively, add a project-level suppression in the test Impact on This PRThis PR's MSBuild import path fixes are correct and unrelated to the failure. The build will pass once the CA1416 issue is resolved on the base branch (or this PR carries the fix forward).
|
The DelegatingTask and NeverCompletingTask test helpers implement
ITask.RunLongRunning, which is annotated [UnsupportedOSPlatform('browser')].
Since the test project declares browser as a supported platform but never
runs in a browser, wrap the two overrides in #pragma warning disable/restore
CA1416, matching the existing suppression style already used in this file.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1b42ef96-9977-4d73-b1a0-6bd952777a4c
|
Addressed in a0c988c. The CA1416 build failure originated on the base branch (the |
…ng-meme # Conflicts: # test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/FileLoggerTests.cs
Fixes #9761
Addresses the two 🔵 suggestions from the MSBuild File Quality Report.
Changes
Microsoft.Testing.Extensions.VideoRecorder/buildTransitive/…props(Rule E-1)Switched from importing directly out of
buildMultiTargeting/to the standardbuild/<tfm>/forwarding pattern used by all 13 other extensions:Verified equivalent: in the package,
buildTransitive/<tfm>/forwards tobuild/<tfm>/, whosebuild/…propsin turn forwards tobuildMultiTargeting/…props— the same real content the old direct import resolved to. Purely a consistency change.Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/…targets(Rule D-1)Prefixed the
CustomTestTarget.targetsimport with$(MSBuildThisFileDirectory)for consistency with the adjacentVSTest.targetsimport. Functionally identical (MSBuild resolves bare relative imports against the importing file's directory).Both changes are non-functional / cosmetic consistency fixes with no behavioral impact.