From c959b0cf5f32f6acbb0539fa853fc5c12a0f5e8b Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 25 Oct 2023 18:17:05 -0700 Subject: [PATCH] Disable hot reload and interactive mode with dotnet watch - When launching dotnet watch on an aspire project, we invoke watch on each of the projects. There's no way to interactively restart a single project on change so its not possible to force a restart if a hot reload change is ineffective (when changing main). In the future, we will need to revamp this entire experience so that it works more like the IDE experience (dcp talks to dotnet watch and it launches multiple projects and notifies DCP of those changes). --- src/Aspire.Hosting/Dcp/ApplicationExecutor.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs b/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs index 310e48259b..2f5e8bf28a 100644 --- a/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs +++ b/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs @@ -291,18 +291,22 @@ private void PrepareProjectExecutables() exeSpec.ExecutionType = ExecutionType.Process; if (Environment.GetEnvironmentVariable("DOTNET_WATCH") != "1") { - exeSpec.Args = new List { + exeSpec.Args = [ "run", "--no-build", - "--project", projectMetadata.ProjectPath, - }; + "--project", + projectMetadata.ProjectPath, + ]; } else { - exeSpec.Args = new List { + exeSpec.Args = [ "watch", - "--project", projectMetadata.ProjectPath - }; + "--non-interactive", + "--no-hot-reload", + "--project", + projectMetadata.ProjectPath + ]; } // We pretty much always want to suppress the normal launch profile handling