Skip to content

Add MSTest DeploymentItem sub-page#54210

Open
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/mstest-deployment-items
Open

Add MSTest DeploymentItem sub-page#54210
Evangelink wants to merge 2 commits into
dotnet:mainfrom
Evangelink:dev/amauryleve/mstest-deployment-items

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Adds a dedicated MSTest Write tests sub-page for the DeploymentItemAttribute. Pairs with microsoft/testfx#8968, which fixes the XML doc comment on the attribute itself (both address microsoft/testfx#8960).

New page

docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md covers:

  • How relative paths resolve against the build output directory (the folder that contains the test assembly), not RunConfig.RelativePathRoot.
  • Class-level vs. method-level usage, with a note about MSTEST0035.
  • Both DeploymentItemAttribute constructor overloads with realistic examples (single file, file with subfolder, folder).
  • How to stage source files via <None>/<Content> + CopyToOutputDirectory or a post-build target.
  • Reading TestContext.DeploymentDirectory at run time.
  • Disabling deployment with <DeploymentEnabled>False</DeploymentEnabled>.
  • Legacy mode (.testsettings / ForcedLegacyMode) caveats around relative-path resolution.
  • Best practices (prefer CopyToOutputDirectory, keep items small, deploy folders, etc.).

Touch-ups in existing pages

  • unit-testing-mstest-writing-tests.md — added the new page to the topic-overview table and the attribute-quick-reference table (new "Test resources" row for DeploymentItem).
  • unit-testing-mstest-writing-tests-testcontext.md — cross-linked the DeploymentDirectory bullet to the new page.
  • docs/navigate/devops-testing/toc.yml — added the new page under the MSTest "Write tests" group.

Notes

cc @Evangelink

Adds a new `Write tests` sub-page that documents `DeploymentItemAttribute`
end to end: how it resolves relative paths against the build output
directory, the two constructor overloads, how to stage source files via
`CopyToOutputDirectory` or post-build events, `TestContext.DeploymentDirectory`,
`DeploymentEnabled`, legacy mode caveats, and best practices.

Cross-links the new page from the main Write tests page (description table
+ attribute quick reference) and the TestContext page, and wires the entry
into devops-testing/toc.yml.

Related to microsoft/testfx#8960 (the matching XML doc comment fix on the
attribute is microsoft/testfx#8968).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 9, 2026 14:15
@Evangelink Evangelink requested review from a team, meaghanlewis and nohwnd as code owners June 9, 2026 14:15
@dotnetrepoman dotnetrepoman Bot added this to the June 2026 milestone Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a dedicated MSTest “Write tests” sub-page that documents DeploymentItemAttribute, and wires the new page into the existing MSTest documentation via navigation and cross-links.

Changes:

  • Adds a new article that explains how DeploymentItemAttribute resolves paths, deploys files/folders, and interacts with TestContext.DeploymentDirectory.
  • Updates the MSTest “Write tests” hub page to include the new topic in the topic table and attribute quick reference.
  • Updates the TestContext page and the DevOps testing TOC to link to the new content.
Show a summary per file
File Description
docs/navigate/devops-testing/toc.yml Adds “Deployment items” under MSTest “Writing tests” navigation.
docs/core/testing/unit-testing-mstest-writing-tests.md Adds the new “Deployment items” topic and an attribute quick-reference row.
docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md Cross-links DeploymentDirectory to the new DeploymentItem article.
docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md New page documenting DeploymentItemAttribute usage, configuration, and best practices.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 7

Comment thread docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md Outdated
Comment thread docs/core/testing/unit-testing-mstest-writing-tests-deployment-items.md Outdated
- Add missing 'using System.IO;' to the two snippets that use File/Path.

- Drop trailing backslash from verbatim folder paths (@"TestFiles\" and @"Resources\") since C# verbatim string literals can't end with a single backslash.

- Rename 'Use a post-build event' section to 'Use a post-build target' to match the MSBuild <Target> example.

Addresses review comments on PR dotnet#54210.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants