Skip to content

Commit 981b74b

Browse files
authored
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 #45042 (comment) Switch to executing the built .dll directly.
1 parent 3093791 commit 981b74b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/Microsoft.NET.Build.Tests/GivenThatWeWantToControlGeneratedAssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,11 @@ static void Main(string[] args)
855855
.Should()
856856
.Pass();
857857

858-
var result = new DotnetCommand(Log, "run")
859-
.WithWorkingDirectory(Path.Combine(testAsset.Path, testProject.Name))
860-
.Execute();
858+
var exePath = Path.Combine(buildCommand.GetOutputDirectory(testProject.TargetFrameworks).FullName, testProject.Name + ".dll");
859+
860+
var result = new DotnetCommand(Log, "exec", exePath).Execute();
861861
result.Should().Pass();
862-
result.StdOut.StripTerminalLoggerProgressIndicators().Should().BeEquivalentTo(expectedFrameworkDisplayName);
862+
result.StdOut.Should().BeEquivalentTo(expectedFrameworkDisplayName);
863863
}
864864
}
865865
}

0 commit comments

Comments
 (0)