From f2cf1d5af82afb1014c727da769916e984ed0d60 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 18 Mar 2025 21:11:12 +0100 Subject: [PATCH] Remove RunSettingsFilePath support from dotnet test for MTP --- src/Cli/dotnet/commands/dotnet-test/CliConstants.cs | 2 -- .../commands/dotnet-test/IPC/Models/ModuleMessage.cs | 2 +- .../IPC/Serializers/ModuleMessageSerializer.cs | 4 +--- src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs | 1 - src/Cli/dotnet/commands/dotnet-test/Models.cs | 2 +- .../commands/dotnet-test/SolutionAndProjectUtility.cs | 3 +-- src/Cli/dotnet/commands/dotnet-test/TestApplication.cs | 10 ---------- .../commands/dotnet-test/TestModulesFilterHandler.cs | 2 +- 8 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/Cli/dotnet/commands/dotnet-test/CliConstants.cs b/src/Cli/dotnet/commands/dotnet-test/CliConstants.cs index fd447074b90d..3ba68cf5b31c 100644 --- a/src/Cli/dotnet/commands/dotnet-test/CliConstants.cs +++ b/src/Cli/dotnet/commands/dotnet-test/CliConstants.cs @@ -41,7 +41,6 @@ internal static class CliConstants public const string BinLogFileName = "msbuild.binlog"; - public const string TestingPlatformVsTestBridgeRunSettingsFileEnvVar = "TESTINGPLATFORM_VSTESTBRIDGE_RUNSETTINGS_FILE"; public const string DLLExtension = ".dll"; public const string MTPTarget = "_MTPBuild"; @@ -91,7 +90,6 @@ internal static class ProjectProperties internal const string TargetFrameworks = "TargetFrameworks"; internal const string TargetPath = "TargetPath"; internal const string ProjectFullPath = "MSBuildProjectFullPath"; - internal const string RunSettingsFilePath = "RunSettingsFilePath"; internal const string RunCommand = "RunCommand"; internal const string RunArguments = "RunArguments"; internal const string RunWorkingDirectory = "RunWorkingDirectory"; diff --git a/src/Cli/dotnet/commands/dotnet-test/IPC/Models/ModuleMessage.cs b/src/Cli/dotnet/commands/dotnet-test/IPC/Models/ModuleMessage.cs index 6cce6ecb5d40..e7a42805d150 100644 --- a/src/Cli/dotnet/commands/dotnet-test/IPC/Models/ModuleMessage.cs +++ b/src/Cli/dotnet/commands/dotnet-test/IPC/Models/ModuleMessage.cs @@ -3,4 +3,4 @@ namespace Microsoft.DotNet.Tools.Test; -internal sealed record ModuleMessage(string? DllOrExePath, string? ProjectPath, string? TargetFramework, string? RunSettingsFilePath, string IsTestingPlatformApplication) : IRequest; +internal sealed record ModuleMessage(string? DllOrExePath, string? ProjectPath, string? TargetFramework, string IsTestingPlatformApplication) : IRequest; diff --git a/src/Cli/dotnet/commands/dotnet-test/IPC/Serializers/ModuleMessageSerializer.cs b/src/Cli/dotnet/commands/dotnet-test/IPC/Serializers/ModuleMessageSerializer.cs index 6eb269a18f97..b57b0c67d362 100644 --- a/src/Cli/dotnet/commands/dotnet-test/IPC/Serializers/ModuleMessageSerializer.cs +++ b/src/Cli/dotnet/commands/dotnet-test/IPC/Serializers/ModuleMessageSerializer.cs @@ -12,9 +12,8 @@ public object Deserialize(Stream stream) string modulePath = ReadString(stream); string projectPath = ReadString(stream); string targetFramework = ReadString(stream); - string runSettingsFilePath = ReadString(stream); string isTestingPlatformApplication = ReadString(stream); - return new ModuleMessage(modulePath.Trim(), projectPath.Trim(), targetFramework.Trim(), runSettingsFilePath.Trim(), isTestingPlatformApplication.Trim()); + return new ModuleMessage(modulePath.Trim(), projectPath.Trim(), targetFramework.Trim(), isTestingPlatformApplication.Trim()); } public void Serialize(object objectToSerialize, Stream stream) @@ -22,7 +21,6 @@ public void Serialize(object objectToSerialize, Stream stream) WriteString(stream, ((ModuleMessage)objectToSerialize).DllOrExePath); WriteString(stream, ((ModuleMessage)objectToSerialize).ProjectPath); WriteString(stream, ((ModuleMessage)objectToSerialize).TargetFramework); - WriteString(stream, ((ModuleMessage)objectToSerialize).RunSettingsFilePath); WriteString(stream, ((ModuleMessage)objectToSerialize).IsTestingPlatformApplication); } } diff --git a/src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs b/src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs index 9337cdfcad4b..01a48e04741f 100644 --- a/src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs +++ b/src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs @@ -162,7 +162,6 @@ private void LogProjectProperties(IEnumerable modules) logMessageBuilder.AppendLine($"{ProjectProperties.RunCommand}: {module.RunProperties.RunCommand}"); logMessageBuilder.AppendLine($"{ProjectProperties.RunArguments}: {module.RunProperties.RunArguments}"); logMessageBuilder.AppendLine($"{ProjectProperties.RunWorkingDirectory}: {module.RunProperties.RunWorkingDirectory}"); - logMessageBuilder.AppendLine($"{ProjectProperties.RunSettingsFilePath}: {module.RunSettingsFilePath}"); logMessageBuilder.AppendLine(); } diff --git a/src/Cli/dotnet/commands/dotnet-test/Models.cs b/src/Cli/dotnet/commands/dotnet-test/Models.cs index 9aaffb252ff4..5107ec79504a 100644 --- a/src/Cli/dotnet/commands/dotnet-test/Models.cs +++ b/src/Cli/dotnet/commands/dotnet-test/Models.cs @@ -3,7 +3,7 @@ namespace Microsoft.DotNet.Cli; -internal sealed record TestModule(RunProperties RunProperties, string? ProjectFullPath, string? TargetFramework, string? RunSettingsFilePath, bool IsTestingPlatformApplication, bool IsTestProject); +internal sealed record TestModule(RunProperties RunProperties, string? ProjectFullPath, string? TargetFramework, bool IsTestingPlatformApplication, bool IsTestProject); internal sealed record Handshake(Dictionary? Properties); diff --git a/src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs b/src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs index efd259772a06..7b2b68281a93 100644 --- a/src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs +++ b/src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs @@ -163,9 +163,8 @@ public static IEnumerable GetProjectProperties(string projectFilePat string targetFramework = project.GetPropertyValue(ProjectProperties.TargetFramework); RunProperties runProperties = GetRunProperties(project, loggers); string projectFullPath = project.GetPropertyValue(ProjectProperties.ProjectFullPath); - string runSettingsFilePath = project.GetPropertyValue(ProjectProperties.RunSettingsFilePath); - return new TestModule(runProperties, PathUtility.FixFilePath(projectFullPath), targetFramework, runSettingsFilePath, isTestingPlatformApplication, isTestProject); + return new TestModule(runProperties, PathUtility.FixFilePath(projectFullPath), targetFramework, isTestingPlatformApplication, isTestProject); static RunProperties GetRunProperties(ProjectInstance project, ICollection? loggers) { diff --git a/src/Cli/dotnet/commands/dotnet-test/TestApplication.cs b/src/Cli/dotnet/commands/dotnet-test/TestApplication.cs index a2a587d9fd29..03cb8bba41e6 100644 --- a/src/Cli/dotnet/commands/dotnet-test/TestApplication.cs +++ b/src/Cli/dotnet/commands/dotnet-test/TestApplication.cs @@ -79,8 +79,6 @@ private ProcessStartInfo CreateProcessStartInfo(bool isDll, TestOptions testOpti processStartInfo.WorkingDirectory = _module.RunProperties.RunWorkingDirectory; } - AddRunSettingsFileToEnvironment(processStartInfo); - return processStartInfo; } @@ -99,14 +97,6 @@ private string GetArguments(TestOptions testOptions, bool isDll) return BuildArgsWithDotnetRun(testOptions); } - private void AddRunSettingsFileToEnvironment(ProcessStartInfo processStartInfo) - { - if (!string.IsNullOrEmpty(_module.RunSettingsFilePath)) - { - processStartInfo.EnvironmentVariables.Add(CliConstants.TestingPlatformVsTestBridgeRunSettingsFileEnvVar, _module.RunSettingsFilePath); - } - } - private static bool IsArchitectureSpecified(TestOptions testOptions) { return !string.IsNullOrEmpty(testOptions.Architecture); diff --git a/src/Cli/dotnet/commands/dotnet-test/TestModulesFilterHandler.cs b/src/Cli/dotnet/commands/dotnet-test/TestModulesFilterHandler.cs index 1ec39fa380d4..673249d9a593 100644 --- a/src/Cli/dotnet/commands/dotnet-test/TestModulesFilterHandler.cs +++ b/src/Cli/dotnet/commands/dotnet-test/TestModulesFilterHandler.cs @@ -53,7 +53,7 @@ public bool RunWithTestModulesFilter(ParseResult parseResult, BuildOptions build foreach (string testModule in testModulePaths) { - var testApp = new TestApplication(new TestModule(new RunProperties(testModule, null, null), null, null, null, true, true), buildOptions); + var testApp = new TestApplication(new TestModule(new RunProperties(testModule, null, null), null, null, true, true), buildOptions); // Write the test application to the channel _actionQueue.Enqueue(testApp); }