aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Hot reload not enabled if dotnet CLI initialized with arguments

Open captainsafia opened this issue 4 years ago • 11 comments

I want to be able to run dotnet watch run --urls="https://localhost:7005" to start my application server at a specific port and have hot reload enabled.

However, hot reload is not enabled if dotnet watch is invoked with non-default parameters.

captainsafia avatar Mar 29 '21 20:03 captainsafia

Thanks for contacting us. We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost avatar Mar 30 '21 16:03 ghost

We are using pathbase in our blazor development and need to pass it in as part of the dotnet command. Are there any workarounds for this at the moment?

rabberbock avatar May 25 '21 18:05 rabberbock

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Aug 12 '21 21:08 ghost

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost avatar Jan 21 '22 21:01 ghost

Workaround is to set the ASPNETCORE_URLS environment variable instead of passing --urls. But yes, please fix this!

MaxHorstmann avatar Feb 11 '22 22:02 MaxHorstmann

Any progress on this? It is kind of sad that you have to hard code any app parameters in the app to use dotnet watch. Why not just forward parameters after -- to the app as with dotnet run.

maloo avatar Mar 04 '22 23:03 maloo

That's a few hours wasted for me before I found this issue... major pain. We se a few env vars in launchSettings.json for local development and dotnet watch run did not select a launch profile (I'm pretty sure it used to do that!) so tried using --launch-profile flag and then hot reload died 🤦‍♂️!

Resorted to a .ps1 file that sets the env vars before dotnet watch run and then running that.

Hope you can get this fixed soon!

christiansparre avatar Mar 24 '22 09:03 christiansparre

Any news on this?

ionoy avatar Apr 20 '22 07:04 ionoy

Same here. I wasted hours before finding this issue. I wanted to select a launch profile with --launch-profile argument or using --urls and hot reload died :(

kurtcodemander avatar Jun 20 '22 21:06 kurtcodemander

I am having the same issue with running a MonoGame game :(

ZachIsAGardner avatar Jun 23 '22 22:06 ZachIsAGardner

@tmat leaving this up to you to prioritize.

mkArtakMSFT avatar Aug 10 '22 17:08 mkArtakMSFT

Chiming in as I'm also experiencing this issue, and it's causing devs to have to wait for a 2-minute build time + ~30-60 seconds to navigate back to the relevant section in the app, for every change they make. Not very productive, as you might imagine. We run various other dev watchers too, which we don't want the VS build to handle in dev mode (webpack etc).

.Net 6 with SDK 6.0.8

I'm using this command:

dotnet watch run --no-restore --launch-profile service-hosts -v n -c Debug-CustomerName

With the following launch profile:

        "service-hosts": {
            "commandName": "Project",
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "launchBrowser": false,
            "dotnetRunMessages": "true",
            "applicationUrl": "https://localhost:12345",
            "sslPort": 12345
        }

And the following env variables:

$Env:ASPNETCORE_ENVIRONMENT = $dotNetEnv;
$Env:ASPNETCORE_URLS = "https://localhost:$($app.port)";
$Env:DOTNET_WATCH_SUPPRESS_EMOJIS = "true";

Bidthedog avatar Aug 17 '22 15:08 Bidthedog

bump

wocar avatar Aug 23 '22 23:08 wocar

Is there any workaround for this issue?

I can also see that it has been moved from .net 7 planning to do .net 8 planning...

marcindruzgala avatar Sep 02 '22 09:09 marcindruzgala

Just upgraded to .net 7 and was disappointed to discover that it still doesn't work as expected.

lonix1 avatar Feb 10 '23 07:02 lonix1