Skip to content

Commit fa094cf

Browse files
Disable logging when loading projects in dotnet test (#49473)
1 parent 65ceb47 commit fa094cf

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/Cli/dotnet/Commands/Test/MSBuildUtility.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ namespace Microsoft.DotNet.Cli.Commands.Test;
1515

1616
internal static class MSBuildUtility
1717
{
18-
private const string dotnetTestVerb = "dotnet-test";
19-
2018
public static (IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModules> Projects, bool IsBuiltOrRestored) GetProjectsFromSolution(string solutionFilePath, BuildOptions buildOptions)
2119
{
2220
SolutionModel solutionModel = SlnFileFactory.CreateFromFileOrDirectory(solutionFilePath, includeSolutionFilterFiles: true, includeSolutionXmlFiles: true);
@@ -32,11 +30,9 @@ public static (IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModul
3230
Path.GetDirectoryName(solutionModel.Description)! :
3331
SolutionAndProjectUtility.GetRootDirectory(solutionFilePath);
3432

35-
FacadeLogger? logger = LoggerUtility.DetermineBinlogger([.. buildOptions.MSBuildArgs], dotnetTestVerb);
36-
var collection = new ProjectCollection(globalProperties: CommonRunHelpers.GetGlobalPropertiesFromArgs([.. buildOptions.MSBuildArgs]), loggers: logger is null ? null : [logger], toolsetDefinitionLocations: ToolsetDefinitionLocations.Default);
33+
var collection = new ProjectCollection(globalProperties: CommonRunHelpers.GetGlobalPropertiesFromArgs([.. buildOptions.MSBuildArgs]), null, toolsetDefinitionLocations: ToolsetDefinitionLocations.Default);
3734

3835
ConcurrentBag<ParallelizableTestModuleGroupWithSequentialInnerModules> projects = GetProjectsProperties(collection, solutionModel.SolutionProjects.Select(p => Path.Combine(rootDirectory, p.FilePath)), buildOptions);
39-
logger?.ReallyShutdown();
4036

4137
return (projects, isBuiltOrRestored);
4238
}
@@ -50,11 +46,9 @@ public static (IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModul
5046
return (Array.Empty<ParallelizableTestModuleGroupWithSequentialInnerModules>(), isBuiltOrRestored);
5147
}
5248

53-
FacadeLogger? logger = LoggerUtility.DetermineBinlogger([.. buildOptions.MSBuildArgs], dotnetTestVerb);
54-
var collection = new ProjectCollection(globalProperties: CommonRunHelpers.GetGlobalPropertiesFromArgs([.. buildOptions.MSBuildArgs]), logger is null ? null : [logger], toolsetDefinitionLocations: ToolsetDefinitionLocations.Default);
49+
var collection = new ProjectCollection(globalProperties: CommonRunHelpers.GetGlobalPropertiesFromArgs([.. buildOptions.MSBuildArgs]), null, toolsetDefinitionLocations: ToolsetDefinitionLocations.Default);
5550

5651
IEnumerable<ParallelizableTestModuleGroupWithSequentialInnerModules> projects = SolutionAndProjectUtility.GetProjectProperties(projectFilePath, collection, buildOptions.NoLaunchProfile);
57-
logger?.ReallyShutdown();
5852

5953
return (projects, isBuiltOrRestored);
6054
}

test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithDifferentOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ public void RunTestProjectSolutionWithBinLogOption_ShouldReturnExitCodeSuccess(s
368368
.Execute("-bl", TestingPlatformOptions.ConfigurationOption.Name, configuration);
369369

370370
Assert.True(File.Exists(string.Format("{0}{1}{2}", testInstance.TestRoot, Path.DirectorySeparatorChar, CliConstants.BinLogFileName)));
371-
Assert.True(File.Exists(string.Format("{0}{1}{2}", testInstance.TestRoot, Path.DirectorySeparatorChar, "msbuild-dotnet-test.binlog")));
372371

373372
result.ExitCode.Should().Be(ExitCodes.Success);
374373
}

0 commit comments

Comments
 (0)