From 981b74b303ff6dfffea783bbaf4ea6eb7e9b9f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 17 Dec 2024 12:10:52 +0100 Subject: [PATCH] Use dotnet exec to run test app in CheckTargetFrameworkDisplayName (#45332) "dotnet run" does some additional steps like restore and build that we don't need and it can cause issues with additional characters in stdout like in https://github.com/dotnet/sdk/pull/45042#issuecomment-2518634869 Switch to executing the built .dll directly. --- .../GivenThatWeWantToControlGeneratedAssemblyInfo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs index 98ebc8121ae7..c1e9e0e94c55 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs @@ -855,11 +855,11 @@ static void Main(string[] args) .Should() .Pass(); - var result = new DotnetCommand(Log, "run") - .WithWorkingDirectory(Path.Combine(testAsset.Path, testProject.Name)) - .Execute(); + var exePath = Path.Combine(buildCommand.GetOutputDirectory(testProject.TargetFrameworks).FullName, testProject.Name + ".dll"); + + var result = new DotnetCommand(Log, "exec", exePath).Execute(); result.Should().Pass(); - result.StdOut.StripTerminalLoggerProgressIndicators().Should().BeEquivalentTo(expectedFrameworkDisplayName); + result.StdOut.Should().BeEquivalentTo(expectedFrameworkDisplayName); } } }