From 89758ef046c167369ff3e20f278bbca40cfc6fab Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Fri, 4 Nov 2022 22:55:00 -0700 Subject: [PATCH 1/2] Get the telemetry version from the --version command and use it to find dotnet.dll --- test/EndToEnd/TelemetryOptOutDefaultTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/EndToEnd/TelemetryOptOutDefaultTests.cs b/test/EndToEnd/TelemetryOptOutDefaultTests.cs index 1a08d49b0..f13724ef0 100644 --- a/test/EndToEnd/TelemetryOptOutDefaultTests.cs +++ b/test/EndToEnd/TelemetryOptOutDefaultTests.cs @@ -10,7 +10,12 @@ namespace EndToEnd.Tests [Fact] public void TelemetryOptOutDefaultAttribute() { - var dotnetdir = Path.Combine(Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest), "sdk", "7.0.100"); + var result = new DotnetCommand() + .ExecuteWithCapturedOutput("--version"); + + var sdkVersion = result.StdOut.Trim(); + + var dotnetdir = Path.Combine(Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest), "sdk", sdkVersion); var result = AssemblyInfo.Get(Path.Combine(dotnetdir, "dotnet.dll"), "AssemblyMetadataAttribute"); result.Should().Contain("TelemetryOptOutDefault:False"); } From ccd4c9b0e2fc08984799c1e7955493f5c4483250 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Sat, 5 Nov 2022 15:13:09 -0700 Subject: [PATCH 2/2] Fix build error. --- test/EndToEnd/TelemetryOptOutDefaultTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/EndToEnd/TelemetryOptOutDefaultTests.cs b/test/EndToEnd/TelemetryOptOutDefaultTests.cs index f13724ef0..caba71157 100644 --- a/test/EndToEnd/TelemetryOptOutDefaultTests.cs +++ b/test/EndToEnd/TelemetryOptOutDefaultTests.cs @@ -10,10 +10,10 @@ namespace EndToEnd.Tests [Fact] public void TelemetryOptOutDefaultAttribute() { - var result = new DotnetCommand() + var versionCommand = new DotnetCommand() .ExecuteWithCapturedOutput("--version"); - var sdkVersion = result.StdOut.Trim(); + var sdkVersion = versionCommand.StdOut.Trim(); var dotnetdir = Path.Combine(Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest), "sdk", sdkVersion); var result = AssemblyInfo.Get(Path.Combine(dotnetdir, "dotnet.dll"), "AssemblyMetadataAttribute");