From e279cb70cff01c7aba93ddcae8bc192e50bcb713 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Fri, 27 Oct 2023 20:19:54 +1100 Subject: [PATCH] feat: Enabling Hot Reload --- src/Uno.Templates/Uno.Templates.csproj | 2 +- .../content/unoapp/MyExtensionsApp._1/App.blank.cs | 4 ++++ .../content/unoapp/MyExtensionsApp._1/App.recommended.cs | 6 ++++++ .../content/unoapp/MyExtensionsApp._1/GlobalUsings.cs | 1 + .../unoapp/MyExtensionsApp._1/MyExtensionsApp._1.csproj | 2 ++ src/Uno.Templates/reinstall.ps1 | 2 +- 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Uno.Templates/Uno.Templates.csproj b/src/Uno.Templates/Uno.Templates.csproj index 5c39b176..46bf0b60 100644 --- a/src/Uno.Templates/Uno.Templates.csproj +++ b/src/Uno.Templates/Uno.Templates.csproj @@ -18,7 +18,7 @@ 3.0.0-dev.2335 - 5.0.0-dev.3597 + 5.1.0-dev.52 1.6.0 2.88.6 4.0.1 diff --git a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.blank.cs b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.blank.cs index 41c4514e..904aa14a 100644 --- a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.blank.cs +++ b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.blank.cs @@ -19,6 +19,10 @@ protected override void OnLaunched(LaunchActivatedEventArgs args) MainWindow = Microsoft.UI.Xaml.Window.Current; #endif +#if DEBUG + MainWindow.EnableHotReload(); +#endif + //+:cnd:noEmit #if mauiEmbedding //-:cnd:noEmit diff --git a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.recommended.cs b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.recommended.cs index 1539b740..d073e8da 100644 --- a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.recommended.cs +++ b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/App.recommended.cs @@ -165,6 +165,12 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args) ); MainWindow = builder.Window; +//-:cnd:noEmit +#if DEBUG + MainWindow.EnableHotReload(); +#endif +//+:cnd:noEmit + #if useFrameNav //-:cnd:noEmit Host = builder.Build(); diff --git a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/GlobalUsings.cs b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/GlobalUsings.cs index e80e7ae7..b8ccdbb1 100644 --- a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/GlobalUsings.cs +++ b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/GlobalUsings.cs @@ -48,6 +48,7 @@ #endif //+:cnd:noEmit #endif +global using Uno.UI; #if (useCsharpMarkup) global using Uno.Extensions.Markup; #if (useMaterial) diff --git a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/MyExtensionsApp._1.csproj b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/MyExtensionsApp._1.csproj index b7985d7f..781b6016 100644 --- a/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/MyExtensionsApp._1.csproj +++ b/src/Uno.Templates/content/unoapp/MyExtensionsApp._1/MyExtensionsApp._1.csproj @@ -260,8 +260,10 @@ + + diff --git a/src/Uno.Templates/reinstall.ps1 b/src/Uno.Templates/reinstall.ps1 index ed43ac11..45b3b40d 100644 --- a/src/Uno.Templates/reinstall.ps1 +++ b/src/Uno.Templates/reinstall.ps1 @@ -6,7 +6,7 @@ param( [string]$ExtensionsVersion = "3.0.0-dev.2335", # Version of published Uno.WinUI packages - [string]$UnoVersion = "5.0.0-dev.3597" + [string]$UnoVersion = "5.1.0-dev.52" ) function RemoveNuGetPackage {