From 2b2153afe6be52842eb58814c6780a57943529df Mon Sep 17 00:00:00 2001 From: Brennan Date: Sat, 9 Nov 2019 17:00:10 -0800 Subject: [PATCH] Change how we resolve dotnet in tests (#16934) --- src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs | 7 ++++++- src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs b/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs index da77434c8d..6d89b4861a 100644 --- a/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs +++ b/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.Extensions.CommandLineUtils; @@ -88,15 +89,19 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests }; args.AddRange(arguments); + var dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes() + .Single(s => s.Key == "DotnetPath").Value; + var spec = new ProcessSpec { - Executable = DotNetMuxer.MuxerPathOrDefault(), + Executable = dotnetPath, Arguments = args, WorkingDirectory = SourceDirectory, EnvironmentVariables = { ["DOTNET_CLI_CONTEXT_VERBOSE"] = bool.TrueString, ["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(), + ["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName, }, }; diff --git a/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj b/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj index b51c978aa7..1a78c90359 100644 --- a/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj +++ b/src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj @@ -17,6 +17,13 @@ + + + <_Parameter1>DotnetPath + <_Parameter2>$(DotNetTool) + + +