9

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:

enter image description here 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.

rory.ap
  • 34,009
  • 10
  • 83
  • 174
Selim Sandal
  • 101
  • 1
  • 6

3 Answers3

2

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

T.S.
  • 18,195
  • 11
  • 58
  • 78
Matt
  • 66
  • 6
  • Hot reload was enabled and the same thing was happening without a major refactor. It seems to be fixed with the current preview build of Visual Studio 2022. – Selim Sandal Sep 04 '22 at 20:09
1

Issue seems to be fixed with the latest preview version of Visual Studio 2022.

Selim Sandal
  • 101
  • 1
  • 6
0

Sometimes u need to rebuild solution. Rebuilding offen helps if hotreload doesn't work

Bek
  • 1
  • 1