Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Watcher.Internal;
using Microsoft.DotNet.Watcher.Tools;
using Microsoft.Extensions.Tools.Internal;
using IReporter = Microsoft.Extensions.Tools.Internal.IReporter;

namespace Microsoft.DotNet.Watcher
{
Expand Down Expand Up @@ -82,7 +85,10 @@ public async Task WatchAsync(DotNetWatchContext context, CancellationToken cance
return;
}

ConfigureExecutable(context, processSpec);
if (context.Iteration == 0)
{
ConfigureExecutable(context, processSpec);
}

using var currentRunCancellationSource = new CancellationTokenSource();
var forceReload = _console.ListenForForceReloadRequest();
Expand Down Expand Up @@ -200,6 +206,12 @@ private static void ConfigureExecutable(DotNetWatchContext context, ProcessSpec
processSpec.EnvironmentVariables["ASPNETCORE_URLS"] = context.DefaultLaunchSettingsProfile.ApplicationUrl;
}

var rootVariableName = Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really the name of the x86 root? That feels different that from what I remember.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable(rootVariableName)))
{
processSpec.EnvironmentVariables[rootVariableName] = Path.GetDirectoryName(new Muxer().MuxerPath);
}

if (context.DefaultLaunchSettingsProfile.EnvironmentVariables is IDictionary<string, string> envVariables)
{
foreach (var entry in context.DefaultLaunchSettingsProfile.EnvironmentVariables)
Expand Down