Skip to content

Add --artifacts-path support to dotnet test in MTP mode#53353

Merged
Youssef1313 merged 2 commits intorelease/10.0.3xxfrom
copilot/fix-dotnet-test-artifacts-path
Mar 11, 2026
Merged

Add --artifacts-path support to dotnet test in MTP mode#53353
Youssef1313 merged 2 commits intorelease/10.0.3xxfrom
copilot/fix-dotnet-test-artifacts-path

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

dotnet test in Microsoft Testing Platform (MTP) mode was missing the --artifacts-path option that VSTest mode and all other MSBuild-integrated commands (build, restore, publish, etc.) support.

Changes

  • TestCommandDefinition.MicrosoftTestingPlatform.cs: Added ArtifactsPathOption via CommonOptions.CreateArtifactsPathOption() — the same factory used by VSTest and build commands. The option uses ForwardAsSingle() to automatically translate --artifacts-path <path>--property:ArtifactsPath=<absolute-path> forwarded to MSBuild through the existing OptionValuesToBeForwarded() path in MSBuildUtility.GetBuildOptions(). No additional parsing logic needed.

  • MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt: Updated help output snapshot to include --artifacts-path <ARTIFACTS_DIR> and corrected line-wrapping to match current terminal width.

Usage

- name: 🧪 Test
  run: dotnet test --configuration Release --no-build --artifacts-path ${{ env.ARTIFACTS_PATH }}
Original prompt

This section details on the original issue you should resolve

<issue_title>dotnet test mtp lost --artifacts-path</issue_title>
<issue_description>### Describe the bug
dotnet test in MTP mode doesn't support the --artifacts-path option that was supported in VStest mode, and supported by other dotnet commands.

To Reproduce

See the below pipeline. I expect to be able to use --artifacts-path ${{ env.ARTIFACTS_PATH }} on the test command like I could in VS test mode, and like I can on other commands. Instead I have to work around by specifying --p:ArtifactsPath=${{ env.ARTIFACTS_PATH }} instead.

jobs:
  build:
    name: 🏗️ Build and test
    runs-on: ubuntu-latest

    env:
      ARTIFACTS_PATH: ${{ github.workspace }}/blahblahblah/

   steps:
      - name: 📥 Restore dependencies
        id: restore
        run: dotnet restore --artifacts-path ${{ env.ARTIFACTS_PATH }} -bl:${{ env.BINLOG_PATH }}/restore.binlog

      - name: 🏗️ Build
        id: build
        run: dotnet build --configuration ${{ inputs.configuration }} --no-restore --artifacts-path ${{ env.ARTIFACTS_PATH }} -bl:${{ env.BINLOG_PATH }}/build.binlog

      - name: 🧪 Test
        id: test
        run: dotnet test --configuration ${{ inputs.configuration }} --no-build --artifacts-path ${{ env.ARTIFACTS_PATH }} -bl:${{ env.BINLOG_PATH }}/test.binlog --output Detailed --results-directory ${{ env.TESTRESULTS_PATH }}

Exceptions (if any)

Further technical details

details of dotnet --info

- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

Comments on the Issue (you are @copilot in this section)

@Youssef1313 Thanks for bringing this to our attention. We should indeed implement this for MTP dotnet test.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix dotnet test to support --artifacts-path option Add --artifacts-path support to dotnet test in MTP mode Mar 10, 2026
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
@Youssef1313 Youssef1313 force-pushed the copilot/fix-dotnet-test-artifacts-path branch from 7cc339e to db4922c Compare March 10, 2026 20:03
@Youssef1313 Youssef1313 marked this pull request as ready for review March 10, 2026 20:03
Copilot AI review requested due to automatic review settings March 10, 2026 20:03
@Youssef1313 Youssef1313 enabled auto-merge (squash) March 10, 2026 20:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing --artifacts-path support to dotnet test when running in Microsoft Testing Platform (MTP) mode, aligning it with VSTest mode and other MSBuild-integrated dotnet commands.

Changes:

  • Added ArtifactsPathOption to the MTP dotnet test command definition via CommonOptions.CreateArtifactsPathOption() (MSBuild-forwarded as ArtifactsPath with absolute path normalization).
  • Updated the MTP help output snapshot to include the new --artifacts-path <ARTIFACTS_DIR> option.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Test/TestCommandDefinition.MicrosoftTestingPlatform.cs Registers the standard --artifacts-path option in MTP mode so it forwards into MSBuild like other commands.
test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt Updates the verified help snapshot to reflect the newly available option.

@Youssef1313 Youssef1313 linked an issue Mar 11, 2026 that may be closed by this pull request
@Youssef1313 Youssef1313 merged commit e05d09b into release/10.0.3xx Mar 11, 2026
33 checks passed
@Youssef1313 Youssef1313 deleted the copilot/fix-dotnet-test-artifacts-path branch March 11, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet test mtp lost --artifacts-path

4 participants