Avoid creating empty deployment directories on .NET Core when no deployment items are used#7801
Merged
Evangelink merged 3 commits intomainfrom Apr 24, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/e059af6c-e11b-44ad-9dc4-82780226338c Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue of creating empty deployment item folders
Avoid creating empty deployment directories on .NET Core when no deployment items are used
Apr 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates MSTest adapter deployment behavior to avoid creating empty TestResults/Deploy_*/... directory trees on .NET (Core/NETCOREAPP) when no tests use [DeploymentItem], while preserving MSTest v1 compatibility behavior on .NET Framework.
Changes:
- Reorders the
hasDeploymentItemsearly-return on non-NETFRAMEWORK builds to skipCreateDeploymentDirectories()entirely when there’s nothing to deploy. - Preserves .NET Framework behavior by still creating deployment directories even when no deployment items exist.
- Updates unit tests to assert
GetDeploymentDirectory() == nullon non-NETFRAMEWORK in “no deployment items” cases.
Show a summary per file
| File | Description |
|---|---|
src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs |
Avoids directory creation on non-NETFRAMEWORK when no deployment items are present; keeps NETFRAMEWORK compat behavior. |
test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/TestDeploymentTests.cs |
Adjusts assertions to match the new NETFRAMEWORK vs non-NETFRAMEWORK behavior. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Evangelink
approved these changes
Apr 24, 2026
…T Core Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/f8a85998-52d5-4864-b5ed-69c82a832631 Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
YuliiaKovalova
approved these changes
Apr 24, 2026
auto-merge was automatically disabled
April 24, 2026 10:35
Merge commits are not allowed on this repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On .NET Core, MSTest was unconditionally creating empty
TestResults/Deploy_*/In/MachineName/directory trees even when no tests used[DeploymentItem].Changes
TestDeployment.cs: On .NET Core, reorder thehasDeploymentItemsearly-return to occur beforeCreateDeploymentDirectories()is called. On .NET Framework, the original behavior is preserved (directories created before the check) for MSTest v1 compat.TestDeploymentTests.cs: Update two test assertions to expectGetDeploymentDirectory() == nullon .NET Core when no deployment items are present (conditionalized with#if NETFRAMEWORK).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
c50vsblobprodcus330.vsblob.vsassets.io/usr/bin/dotnet dotnet test test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -f net9.0 --filter FullyQualifiedName~TestDeploymentTests(dns block)/usr/bin/dotnet dotnet build test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -f net9.0 -c Debug(dns block)jd4vsblobprodcus366.vsblob.vsassets.io/usr/bin/dotnet dotnet test test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -f net9.0 --filter FullyQualifiedName~TestDeploymentTests(dns block)/usr/bin/dotnet dotnet build test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestAdapter.PlatformServices.UnitTests.csproj -f net9.0 -c Debug(dns block)If you need me to access, download, or install something from one of these locations, you can either: