How to use HotReload feature in Xamarin.Forms UWP project
Asked Answered
P

5

5

I've added UWP project to my Xamarin.Forms solution. There is a link on the top of the page that says: Hot Reload Available

but nothing happens when I change the XAML code!. as far as I've checked, for this feature, I should not add any extra libraries of extensions. how can I turn-on this feature?

Potato answered 15/8, 2019 at 1:5 Comment(3)
learn.microsoft.com/en-us/xamarin/xamarin-forms/xaml/hot-reloadWersh
@Wersh your comment is the answer . would you please post that, so I can mark it.Potato
@Potato have you tried the reload from 16.8 update?Froggy
B
9

EDIT: The documentation I referenced below now states that hot reload is now implemented for Xamarin Forms UWP apps in addition to iOS and Android. Yay!

I'm adding this answer in the hope that it saves someone else some time wondering why it isn't working for them.

The short answer to the question originally asked is that, right now

Hot Reload is NOT available for Xamarin Forms UWP projects.

despite that misleading "Hot Reload available" message at the top of the window in the emulator.

It DOES work for Xamarin Forms iOS and Android projects, and it works for non-Xamarin UWP projects.

This is documented, a few paragraphs down:

http://learn.microsoft.com/en-us/xamarin/xamarin-forms/xaml/hot-reload

I suggest you upvote this suggestion if you want it to receive more attention:

https://developercommunity.visualstudio.com/content/idea/661682/xaml-hot-reload-for-xamarinforms-on-uwp.html

Beulahbeuthel answered 4/10, 2019 at 0:12 Comment(3)
It's explicitely written that it's supported.Pebble
@Pebble I guess they finally implemented it for UWP. At the time I wrote this answer is was explicitly Android and iOS only. I’ll update my answer.Beulahbeuthel
don't update, it still does not work, even if it says it does, even if the VS UI says hot reload connected. It still don't work.Pebble
G
2

No additional installation or setup is required to use XAML Hot Reload. It's built into Visual Studio and can be enabled in the IDE settings. Once enabled, you can start using XAML Hot Reload by debugging your app on an emulator, simulator, or physical device.

On Windows, XAML Hot Reload can be enabled by checking the Enable Xamarin Hot Reload checkbox at Tools > Options > Xamarin > Hot Reload.

For more information, please visit the documentation.

Best regards.

Germane answered 15/8, 2019 at 2:7 Comment(0)
L
2

First of all Hot Reload is still in preview as of Aug 15, 19' and is being tested by the community and has a bunch of known bugs and issues.

Below are the minimum requirements for you to be able to use hot reload

Visual Studio 2019 16.3 or greater

Visual Studio 2019 for Mac 8.3 or greater

Xamarin.Forms 4.1 or greater

Now you can enable hot reload by:

On Windows, XAML Hot Reload can be enabled by checking the Enable Xamarin Hot Reload checkbox at Tools > Options > Xamarin > Hot Reload.

On a Mac, XAML Hot Reload can be enabled by checking the Enable Xamarin Hot Reload checkbox at Visual Studio > Preferences > Projects > Xamarin Hot Reload.

Limitations (Known)

You can't add, remove, or rename files or NuGet packages during a XAML Hot Reload session.

If you add or remove a file or NuGet package, rebuild and redeploy your app to continue using XAML Hot Reload.

Set the linker to Link None for the best experience. The Link SDK only setting works most of the time, but it may fail in certain cases.

Debugging on a physical iPhone requires the interpreter to use XAML Hot Reload. Add --interpreter to the Additional mtouch arguments field in your iOS Build settings to use XAML Hot Reload.

Any references created by assigning a control to another field or property using its x:Name value won't be reloaded.

Updating the visual hierarchy of your Shell application in AppShell.xaml can cause issues maintaining the state of your application. Rebuild the app to continue reloading. XAML Hot Reload can't reload C# code, including event handlers, custom controls, page code-behind, and additional classes.

For future references, you can check the official document of Hot Reload

Lutenist answered 15/8, 2019 at 9:16 Comment(2)
I've checked the link. but this hot-reload works with Andriod simulator in windows, but I can find the way to use that in WUP project.Potato
I am not sure if uwp simulators are fully supported yet, you might wanna add this bug to Bugzilla I suppose.Lutenist
F
2

Hotreload for UWP project was released with stable 16.8 Update.

Make sure you have enabled UWP

enter image description here

and set the mode to "Changes only" under Tools -> Options -> Debugging -> Hot Reload

Xamarin.Forms “changes only” XAML Hot Reload now supports UWP: in this release we begin to rollout support for a highly requested feature that enables the new changes only XAML Hot Reload support in Xamarin.Forms Projects when targeting UWP. Please note this feature is still in development, and while editing XAML will now trigger updates in the running app other features such as in-app toolbar (element selection, etc.) are not yet fully implemented, but will be in a future release.

Froggy answered 28/8, 2020 at 14:1 Comment(0)
D
-1

XAML Hot Reload only works when debugging on iOS or Android.

Check Documentation : https://learn.microsoft.com/en-us/xamarin/xamarin-forms/xaml/hot-reload

Delainedelainey answered 25/11, 2019 at 19:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.