diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs index df12306aae..e4898b2a84 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs @@ -399,7 +399,17 @@ public async Task InvokeTestingPlatform_Target_Should_Set_DotnetRoot_For_AppHost environmentVariables: CreateEnvironmentVariables(), cancellationToken: TestContext.CancellationToken); - derivedResult.AssertOutputContains($"[env] {dotnetRootVariableName}={dotnetRoot}"); + string dotnetRootOutputPrefix = $"[env] {dotnetRootVariableName}="; + string? dotnetRootOutput = derivedResult.StandardOutputLines + .Select(line => line.TrimStart()) + .FirstOrDefault(line => line.StartsWith(dotnetRootOutputPrefix, StringComparison.Ordinal)); + Assert.IsNotNull(dotnetRootOutput, derivedResult.ToString()); + // DOTNET_HOST_PATH can preserve different drive-letter casing than RootFinder on Windows. + Assert.AreEqual( + dotnetRoot, + dotnetRootOutput[dotnetRootOutputPrefix.Length..], + ignoreCase: OperatingSystem.IsWindows(), + derivedResult.ToString()); DotnetMuxerResult explicitResult = await DotnetCli.RunAsync( $"build -t:Test -p:TestingPlatformCaptureOutput=False -p:ExplicitDotnetRoot=\"{dotnetRoot}\" \"{testAsset.TargetAssetPath}\"",