diff --git a/docs/xaml/hot-reload.md b/docs/xaml/hot-reload.md index 282aa79e1..edcc8248d 100644 --- a/docs/xaml/hot-reload.md +++ b/docs/xaml/hot-reload.md @@ -1,7 +1,7 @@ --- title: "XAML Hot Reload for .NET MAUI" description: "Learn how to reload changes to your .NET MAUI XAML file instantly on your running app, so you don't have to rebuild your .NET MAUI project after every XAML change." -ms.date: 06/23/2022 +ms.date: 10/25/2022 --- # XAML Hot Reload for .NET MAUI @@ -10,20 +10,12 @@ ms.date: 06/23/2022 When your .NET MAUI app is running in debug configuration, with the debugger attached, XAML Hot Reload parses your XAML edits and sends those changes to the running app. It preserves your UI state, since it doesn't recreate the UI for the full page, and updates changed properties on controls affected by edits. In addition, your navigate state and data will be maintained, enabling you to quickly iterate on your UI without losing your location in the app. Therefore, you'll spend less time rebuilding and deploying your apps to validate UI changes. -By default, you don't need to save your XAML file to see the results of your edits. Instead, updates are applied immediately as you type. However, you can change this behavior to update only on file save. This can be accomplished by checking the **Apply XAML Hot Reload on document save** checkbox in the Hot Reload IDE settings available by selecting **Debug > Options> XAML Hot Reload** from the Visual Studio menu bar. Only updating on file save can sometimes be useful if you make bigger XAML updates and don't wish them to be displayed until they are complete. - - - - - - +By default, you don't need to save your XAML file to see the results of your edits. Instead, updates are applied immediately as you type. However, on Windows you can change this behavior to update only on file save. This can be accomplished by checking the **Apply XAML Hot Reload on document save** checkbox in the Hot Reload IDE settings available by selecting **Debug > Options> XAML Hot Reload** from the Visual Studio menu bar. Only updating on file save can sometimes be useful if you make bigger XAML updates and don't wish them to be displayed until they are complete. > [!NOTE] > If you're writing a native UWP or WPF app, without using .NET MAUI, see [What is XAML Hot Reload for WPF and UWP apps?](/visualstudio/xaml-tools/xaml-hot-reload). - - -On Windows, XAML Hot Reload is available on Android, iOS, and WinUI on emulators, simulators, and physical devices. +XAML Hot Reload is available in both Visual Studio 2022 and Visual Studio 2022 for Mac. On Windows, XAML Hot Reload is available on Android, iOS, and WinUI on emulators, simulators, and physical devices. On Mac, XAML Hot Reload is available on Android, iOS, and Mac Catalyst on emulators, simulators, and physical devices. > [!IMPORTANT] > XAML Hot Reload doesn't reload C# code, including event handlers. @@ -32,18 +24,35 @@ On Windows, XAML Hot Reload is available on Android, iOS, and WinUI on emulators ## Enable XAML Hot Reload + +# [Visual Studio](#tab/vswin) + + XAML Hot Reload is enabled by default in Visual Studio 2022. If it's been previously disabled, it can be enabled by selecting **Debug > Options > XAML Hot Reload** from the Visual Studio menu bar. Next, in the **Options** dialog box, ensure that the **Enable XAML Hot Reload**, **WinUI (including .NET MAUI)**, and **Android and iOS (.NET MAUI)** options are checked: -:::image type="content" source="media/hot-reload/options.png" alt-text="XAML Hot Reload options for .NET MAUI."::: +:::image type="content" source="media/hot-reload/vs-options.png" alt-text="XAML Hot Reload options for .NET MAUI in Visual Studio."::: + +Then, on iOS in your build settings, check that the Linker is set to "Don't Link". - + +# [Visual Studio for Mac](#tab/vsmac) + + +XAML Hot Reload is enabled by default in Visual Studio 2022 for Mac. If it's been previously disabled, it can be enabled by selecting **Visual Studio > Preferences > Other > XAML Hot Reload** from the Visual Studio menu bar. Next, in the **Preferences** dialog box, ensure that the **Enable XAML Hot Reload**, and **.NET MAUI** options are checked: + +:::image type="content" source="media/hot-reload/vsmac-preferences.png" alt-text="XAML Hot Reload options for .NET MAUI in Visual Studio for Mac"::: Then, on iOS in your build settings, check that the Linker is set to "Don't Link". +--- + +## Reload on multiple platforms + +XAML Hot Reload supports simultaneous debugging of multiple platforms in Visual Studio and Visual Studio for Mac, provided that you have separate head projects per platform rather than a single project app. For example, you can deploy an Android and an iOS target at the same time to see your changes reflected on both platforms at once. To debug on multiple platforms on Windows, see [How To: Set multiple startup projects](/visualstudio/ide/how-to-set-multiple-startup-projects). To debug on multiple platforms on a Mac, see [Set multiple startup projects](/visualstudio/mac/set-startup-projects). + ## Troubleshooting -The XAML Hot Reload output displays status messages that can help with troubleshooting. These can be displayed by selecting **View > Output** from the Visual Studio menu bar, and then selecting **Xamarin Hot Reload** in the **Show output from:** drop-down. - +The XAML Hot Reload output displays status messages that can help with troubleshooting. In Visual Studio, these can be displayed by selecting **View > Output** from the menu bar, and then selecting **Xamarin Hot Reload** in the **Show output from:** drop-down. In Visual Studio for Mac, these can be displayed by hovering your mouse cursor over **XAML Hot Reload** in the status bar. If XAML Hot Reload fails to initialize you should ensure that you're using the latest version of .NET MAUI, the latest version of the IDE, and that your iOS linker settings are set to **Don't Link** in the project's build settings. diff --git a/docs/xaml/media/hot-reload/options.png b/docs/xaml/media/hot-reload/vs-options.png similarity index 100% rename from docs/xaml/media/hot-reload/options.png rename to docs/xaml/media/hot-reload/vs-options.png diff --git a/docs/xaml/media/hot-reload/vsmac-preferences.png b/docs/xaml/media/hot-reload/vsmac-preferences.png new file mode 100644 index 000000000..6cb9e6bba Binary files /dev/null and b/docs/xaml/media/hot-reload/vsmac-preferences.png differ