Is live reloading supported in server side blazor yet?
It should work just like it does with regular razor views in AspNetCore.
Yes, once you edit a .cshtml file, next time you reload the page in your browser it will recompile in VS before the page reloads. Note that this is currently only supported if you're using VS (not VS Code).
@stevesandersonms This only works for me when using the regular webassebly version (Either Hosted or Standalone)
However it didn't work when using Server Side Blazor (Neither when debugging, nor when launching the app with CTRL+F5). Do I need to do any additional configuration to get it that work?
@SteveSandersonMS, I have the same problem.
@BickelLukas @cores-system I'm not able to reproduce this. Could you please provide more specific details on how to reproduce the issue?:
@danroth27
just updated everything to the latest Version.
Blazor version: 0.7.0
VS version: 15.8.9
.NET Core version: 2.1.500
Blazor Extension Version: 15.7.20181115.1
Steps followed:
Expected Behavior:
Changes are shown in the Browser.
Observed Behavior:
The Browser is still showing the state that was present when the project was launched
Heres a screen recording of exactly what I did.
Screen Recording.zip
Thanks for this detailed information! The reason the app doesn't restart in this case is because you ran the app as a standalone app instead of using IIS Express. Currently we only support auto restarting the app when hosted behind IIS Express and not running under the debugger. If you want auto restart behavior for a standalone app, you need to use something like dotnet watch. Or just use IIS Express and it should work fine.
Since this tooling limitation isn't really a Blazor specific issue I'm going to go ahead and close this issue.
To integrate watch and live reloading you can add this to your launchsettings.json:
"Watch": {
"executablePath": "dotnet.exe",
"commandLineArgs": "watch --project ..\\..\\..\\..\\YOURPROJECT.csproj run -c Debug",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
To be clear, that edit should be made inside profiles. You can also avoid the --project... arg if you use "workingDirectory": "$(ProjectDir)",, like so:
"dotnet watch run": {
"commandName": "Executable",
"executablePath": "dotnet",
"workingDirectory": "$(ProjectDir)",
"commandLineArgs": "watch run",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
However, I don't have success with the browser opening despite the above. Does anyone else have success with that?
Thanks for the update. But you have to open the browser manually as far as I know.
@WhistlerHusky yes, you can make the browser refresh if you change the code. https://github.com/martasp/BlazorLiveReload
Most helpful comment
To be clear, that edit should be made inside
profiles. You can also avoid the--project...arg if you use"workingDirectory": "$(ProjectDir)",, like so:However, I don't have success with the browser opening despite the above. Does anyone else have success with that?