From ab3aab9c226fee9df9065f23333ffccbadae70ea Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 1 Jan 2022 22:05:24 +0900 Subject: [PATCH] Make BTCPayServer works with dotnet watch hot reload --- BTCPayServer/BTCPayServer.csproj | 6 +++--- BTCPayServer/Hosting/Startup.cs | 2 -- BTCPayServer/Program.cs | 6 +++++- Build/Common.csproj | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 1ae3ceb33..86a97aad4 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -1,4 +1,4 @@ - + @@ -8,7 +8,6 @@ true - @@ -88,7 +87,7 @@ - + @@ -148,6 +147,7 @@ + PreserveNewest $(IncludeRazorContentInPack) diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index d0b960af6..c46fefdeb 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -135,9 +135,7 @@ namespace BTCPayServer.Hosting o.PageViewLocationFormats.Add("/{0}.cshtml"); }) .AddNewtonsoftJson() -#if RAZOR_RUNTIME_COMPILE .AddRazorRuntimeCompilation() -#endif .AddPlugins(services, Configuration, LoggerFactory) .AddControllersAsServices(); diff --git a/BTCPayServer/Program.cs b/BTCPayServer/Program.cs index 9a31eac50..fdaca5c34 100644 --- a/BTCPayServer/Program.cs +++ b/BTCPayServer/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.IO; using System.Net; using System.Runtime.CompilerServices; @@ -18,6 +19,8 @@ namespace BTCPayServer { static void Main(string[] args) { + if (args.Length > 0 && args[0] == "run") + args = args.Skip(1).ToArray(); // Hack to make dotnet watch work ServicePointManager.DefaultConnectionLimit = 100; IWebHost host = null; var processor = new ConsoleLoggerProcessor(); @@ -59,7 +62,8 @@ namespace BTCPayServer var urls = host.ServerFeatures.Get().Addresses; foreach (var url in urls) { - logger.LogInformation("Listening on " + url); + // Some tools such as dotnet watch parse this exact log to open the browser + logger.LogInformation("Now listening on: " + url); } host.WaitForShutdown(); } diff --git a/Build/Common.csproj b/Build/Common.csproj index 3831b2e3d..c8427b603 100644 --- a/Build/Common.csproj +++ b/Build/Common.csproj @@ -22,9 +22,8 @@ - + false - $(DefineConstants);RAZOR_RUNTIME_COMPILE