From 2f30a4676954de83da23c27cef102456f505903d Mon Sep 17 00:00:00 2001 From: VS MobileTools Engineering Service 2 Date: Mon, 23 Aug 2021 23:04:37 -0700 Subject: [PATCH] [release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517) * [net6] Bumps Xamarin Hot Restart to 1.0.70 This version contains fixes for building Maui projects with Hot Restart * [msbuild] Fixes Hot Restart Entitlements.plist compilation The build was failing if `CodesignEntitlements` was not set, even though the CompileEntitlements task has a default value. That default value is not compatible with Hot Restart because it is a template file that exists on the Mac (and Hot Restart is an offline build from Windows). So if that property is not set we get the xcent file from the Hot Restart PreBuilt app bundle, which is essentially an empty plist. * [net6] Makes Hot Restart consider Single Project app title On a Maui Single Project the app title can be set on the project file using the `ApplicationTitle` property. If that's set Hot Restart should include that value in the compiled app manifest, so the app name is shown on the device when the app is deployed. Co-authored-by: Emanuel Fernandez Dell'Oca --- msbuild/Directory.Build.props | 2 +- .../Tasks/CompileAppManifest.cs | 6 ++++++ .../Xamarin.iOS.HotRestart.targets | 10 ++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/msbuild/Directory.Build.props b/msbuild/Directory.Build.props index 7c25c4db49a7..93a0e7c97cca 100644 --- a/msbuild/Directory.Build.props +++ b/msbuild/Directory.Build.props @@ -1,6 +1,6 @@ 1.3.27 - 1.0.69 + 1.0.70 diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs b/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs index 967b5a6ae0d8..ac2901d578cd 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs @@ -31,6 +31,8 @@ public class CompileAppManifest : Task [Required] public string AppManifestPath { get; set; } + public string ApplicationTitle { get; set; } + #endregion public override bool Execute() @@ -60,6 +62,10 @@ public override bool Execute() } } + if (!string.IsNullOrEmpty (ApplicationTitle)) { + preBuiltInfoPlist[ManifestKeys.CFBundleDisplayName] = ApplicationTitle; + } + preBuiltInfoPlist.Save(preBuiltInfoPlistPath, binary: true); return true; diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.HotRestart.targets b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.HotRestart.targets index 866a0cf8e5a8..5c82505fdbd4 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.HotRestart.targets +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.HotRestart.targets @@ -176,7 +176,8 @@ + AppManifestPath="$(_AppManifest)" + ApplicationTitle="$(ApplicationTitle)"/> + + <_HotRestartEntitlementsFile>$(CodesignEntitlements) + <_HotRestartEntitlementsFile Condition="'$(_HotRestartEntitlementsFile)'== ''">$(HotRestartAppBundlePath)\archived-expanded-entitlements.xcent + +