How to refresh page in Blazor development process after code changing
Asked Answered
D

2

7

For me, a biggest discomfort of Blazor development is absent to simple refreshing page after tiny changing HTML of style in source code. Since ASP.NET was born this opportunity has been present - we changing something in HTML or in code, than simple click refresh in browser and new page instantly was appear in browser. But in Blazor development even after tiny changing code or HTML we must stop web server then start full compilation sourse code again and after compilation has been ended successfully IIS will be started and Browser will be started. And even after that HTML-page will be showing in Browser. In Classic ASP.NET we was have even more faster development method - Designer of Visual Studio with directly showing any HTML-changing. Current Blazor development process slows down speed of Web-development for millions times. Is this possible to restore convenient ASP.NET workflow of web-development in Blazor at least to the MVC development speed (with simple refresh page in Browser without recompliation and restarting all development components after tiny changing of code or HTML?

Deadening answered 26/6, 2020 at 10:55 Comment(3)
Is this what you mean? medium.com/@sefatanam/…Aryn
Server side or webassembly?Endermic
Server side now refreshing only without connected debugger. But so far any ASP.NET site has been refreshed with connected debugger. This problem is critically slow down performance of Blazor development. Development in Blazor at common a millions slow times slow than Classic ASP NET, because MS refused support Visual Studio Designer, refused support various masters in VS, refused support jQuery with Blazor and even refused support VB.NET (because VB.NET is improvement of ancient C syntax to delete most stupid C# characteristic like named Inheritance and Implementation by the same char ":").Deadening
C
1

There is a commercial solution called LiveSharp.net which solves most of your problems. They offer a free trial. I personally use it and it really saves a lot of time, especially when doing CSS / HTML tweaking.

In addition, .NET 6 is announced to offer hot reload out of the box.

Cagey answered 10/4, 2021 at 19:22 Comment(0)
A
0
<script>
    Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
        document.location.reload();
    }
</script>

Paste it in _Host.cshtml file (or your custom host file) in the body section like this:

Aryn answered 26/6, 2020 at 11:4 Comment(3)
How do you expect to be able to debug DLLs that you don't want to build?Marxmarxian
To Krystian Borysewicz And on your screen I can see Radzen.Blazor.js. I have installed package Radzen.Blazor, but Loading failed for the <script> with source “localhost:57222/_content/Radzen.Blazor.js”. Maybe you have not actual version.Deadening
To Peter Morris - the same way as I was done this in ASP.NET last 18 year before Blazor was born - Background compilation and changing DLL in background.Deadening

© 2022 - 2024 — McMap. All rights reserved.