.NET MAUI Hot Reload Not Working After Adding Custom Build Configurations

62 Views Asked by At

I'm working on a .NET MAUI project and have added custom build configurations to both the .sln and .csproj files to handle different development and production scenarios. However, after adding these configurations, the Hot Reload feature has stopped working. I replicated the issue with a fresh .NET MAUI project and confirmed that adding the custom configurations causes Hot Reload to fail.

In the .sln file, I added:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiApp2", "MauiApp2\MauiApp2.csproj", "{0F247F8F-3CE4-40EA-837C-05F6F360C8FB}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        DebugDev|Any CPU = DebugDev|Any CPU
        DebugProd|Any CPU = DebugProd|Any CPU
        ReleaseDev|Any CPU = ReleaseDev|Any CPU
        ReleaseProd|Any CPU = ReleaseProd|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.DebugDev|Any CPU.ActiveCfg = DebugDev|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.DebugDev|Any CPU.Build.0 = DebugDev|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.DebugDev|Any CPU.Deploy.0 = DebugDev|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.DebugProd|Any CPU.ActiveCfg = DebugProd|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.DebugProd|Any CPU.Build.0 = DebugProd|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.ReleaseDev|Any CPU.ActiveCfg = ReleaseDev|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.ReleaseDev|Any CPU.Build.0 = ReleaseDev|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.ReleaseProd|Any CPU.ActiveCfg = ReleaseProd|Any CPU
        {0F247F8F-3CE4-40EA-837C-05F6F360C8FB}.ReleaseProd|Any CPU.Build.0 = ReleaseProd|Any CPU
    EndGlobalSection
EndGlobal

and in the .csproj inside the PropertyGroup i added:

<Configurations>DebugDev;ReleaseDev;ReleaseProd;DebugProd</Configurations>

I expected Hot Reload to continue working with these new configurations, just as it does with the default Debug and Release configurations. I made sure to rebuild the project and ensure that the active configuration matches the one I'm running, but Hot Reload still doesn't reflect changes made in XAML files.

I was hoping to maintain Hot Reload functionality while being able to switch between custom development and production configurations for a more streamlined workflow.

Question: How can I retain Hot Reload functionality while using custom build configurations in a .NET MAUI project?

0

There are 0 best solutions below