From 41d7049fc690fca65c038ea85b5bb52338b2d3f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:29:37 +0000 Subject: [PATCH 1/3] Initial plan From 18cd823dfec2994d5e5558af3f09f45ac32138a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:40:25 +0000 Subject: [PATCH 2/3] Avoid creating deployment item folders when not used on .NET Core Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/e059af6c-e11b-44ad-9dc4-82780226338c Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../Services/TestDeployment.cs | 11 +++++++++++ .../Services/TestDeploymentTests.cs | 12 ++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs index 2fc480dc1e..85e11caecd 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs @@ -128,6 +128,8 @@ public bool Deploy(IEnumerable testCases, IRunContext? runContext, IFr } string? firstTestSource = testCases.FirstOrDefault()?.Source; + +#if NETFRAMEWORK RunDirectories = _deploymentUtility.CreateDeploymentDirectories(runContext, firstTestSource); // Deployment directories are created but deployment will not happen. @@ -136,6 +138,15 @@ public bool Deploy(IEnumerable testCases, IRunContext? runContext, IFr { return false; } +#else + // On .NET Core, avoid creating empty deployment folders when no deployment items are used. + if (!hasDeploymentItems) + { + return false; + } + + RunDirectories = _deploymentUtility.CreateDeploymentDirectories(runContext, firstTestSource); +#endif // Object model currently does not have support for SuspendCodeCoverage. We can remove this once support is added #if NETFRAMEWORK diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/TestDeploymentTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/TestDeploymentTests.cs index 4ac9f1a50c..5709e26406 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/TestDeploymentTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/TestDeploymentTests.cs @@ -219,8 +219,12 @@ public void DeployShouldReturnFalseWhenDeploymentEnabledSetToFalseAndHasNoDeploy // Deployment should not happen testDeployment.Deploy(new List { testCase }, null, null!).Should().BeFalse(); - // Deployment directories should get created + // Deployment directories should get created on .NET Framework for compat, but not on .NET Core +#if NETFRAMEWORK testDeployment.GetDeploymentDirectory().Should().NotBeNull(); +#else + testDeployment.GetDeploymentDirectory().Should().BeNull(); +#endif } public void DeployShouldReturnFalseWhenDeploymentEnabledSetToTrueButHasNoDeploymentItems() @@ -242,8 +246,12 @@ public void DeployShouldReturnFalseWhenDeploymentEnabledSetToTrueButHasNoDeploym // Deployment should not happen testDeployment.Deploy(new List { testCase }, null, null!).Should().BeFalse(); - // Deployment directories should get created + // Deployment directories should get created on .NET Framework for compat, but not on .NET Core +#if NETFRAMEWORK testDeployment.GetDeploymentDirectory().Should().NotBeNull(); +#else + testDeployment.GetDeploymentDirectory().Should().BeNull(); +#endif } // TODO: This test has to have mocks. It actually deploys stuff and we cannot assume that all the dependencies get copied over to bin\debug. From 2768502676ae2760bd6755164dcad0694b40f6fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 09:52:30 +0000 Subject: [PATCH 3/3] Move firstTestSource assignment after hasDeploymentItems check on .NET 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> --- .../MSTestAdapter.PlatformServices/Services/TestDeployment.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs index 85e11caecd..87858290dc 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs @@ -127,9 +127,8 @@ public bool Deploy(IEnumerable testCases, IRunContext? runContext, IFr return false; } - string? firstTestSource = testCases.FirstOrDefault()?.Source; - #if NETFRAMEWORK + string? firstTestSource = testCases.FirstOrDefault()?.Source; RunDirectories = _deploymentUtility.CreateDeploymentDirectories(runContext, firstTestSource); // Deployment directories are created but deployment will not happen. @@ -145,6 +144,7 @@ public bool Deploy(IEnumerable testCases, IRunContext? runContext, IFr return false; } + string? firstTestSource = testCases.FirstOrDefault()?.Source; RunDirectories = _deploymentUtility.CreateDeploymentDirectories(runContext, firstTestSource); #endif