I want to launch my Blazor app with specific configuration and have hot-reload enabled.
When I launch with:
dotnet watch
Hot reload is enabled and everything it's ok.
When I lanch with:
dotnet watch run -c Simulation
Hot reload is not active and the app rebuild when a file is changed.
I have try to launch with:
dotnet watch -c Simulation
But it's return "watch : Exited with error code 1".
How launch my app with wanted configuration and hot-reload ?
EDIT:
My launch profile from launchSettings.json file:
"Dotnet Watch": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"commandLineArgs": "watch run -c $(Configuration)",
"hotReloadProfile": "aspnetcore",
"workingDirectory": "$(ProjectDir)",
"launchUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
Adding "hotReloadProfile": "aspnetcore" doesn't work.
And my dotnet version is :
6.0.300-preview.22154.4
EDIT2:
Temporary I use environment variable and not project configurations to switch between Simulation profile and others, but it's strange to not have any solution's to have hot reload with a specific profile. Nothing on the web about that.
launchsettings.json
about how to run the project. In this case, when youdotnet run
, dotnet will ... call dotnet to watch-run your project (?) but, this on itself will create an infinite loop. Why don't you change your json to the default values and try runningdotnet watch run -c [...]
from terminal? – Hakenkreuzdotnet watch run -c Simulation
, withdotnet watch run --property:Configuration=Simulation
, withdotnet watch run -c Simulation --launch-profile "dotnet"
and all the time hot-reload is not activated, the project is rebuild ate every save. – Eastwood6.0.300-preview.22204.3
? – Hakenkreuz