Reputation: 161
I'm using Visual Studio 2022 (17.2 Preview 4) to use .NET MAUI for windows.
When trying to hot reload with the default project it gives the error "Hot reload can't automatically apply your changes. The app needs to be rebuilt to apply updates." I'm using the Debug configuration and the app starts normally. Happens with both Android and Windows builds. How can I solve this?
Here is the screenshot and warning:
Warning ENC1005 The current content of source file 'C:\Users\selim\source\repos\MauiApp1\MauiApp1\MainPage.xaml.cs' does not match the built source. Any changes made to this file while debugging won't be applied until its content matches the built source.
Upvotes: 14
Views: 9448
Reputation: 11
Sometimes u need to rebuild solution. Rebuilding offen helps if hotreload doesn't work
Upvotes: 1
Reputation: 161
Issue seems to be fixed with the latest preview version of Visual Studio 2022.
Upvotes: 2
Reputation: 134
I've noticed if you performed a major refactoring or made changes that result in an error, Hot Reload won't work.
If this doesn't apply to you, I learned that it may be that Hot Reload is disabled and you need to enable it. You should go to Debug > Options> XAML Hot Reload
in Visual Studio. Then in the Options dialog make sure that Enable XAML Hot Reload
, WinUI (including .NET MAUI)
, and Android and iOS (.NET MAUI)
are checked.
https://learn.microsoft.com/en-us/dotnet/maui/xaml/hot-reload#enable-xaml-hot-reload
Upvotes: 4