Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get reload to work outside of Visual Studio? #835

Closed
Kralizek opened this issue Nov 15, 2023 · 13 comments
Closed

How to get reload to work outside of Visual Studio? #835

Kralizek opened this issue Nov 15, 2023 · 13 comments

Comments

@Kralizek
Copy link

I'm trying to get my services reloaded automatically while working with JetBrains Rider.

I've tried the following:

@DamianEdwards
Copy link
Member

'dotnet watch' works from the command line but will tear down more than required until it's updated to implement the launch semantics. Same goes for Rider.

@Kralizek
Copy link
Author

Just an update here: as far as I see, using dotnet watch --project AppHost run doesn't restart resource projects when modified. It works hitting CTRL+R on the terminal, but I would love the same experience as in tye run --watch

@rcocks-hl
Copy link

Hitting CTRL+R also has the large downside of restarting everything.

Ideally just the affected project would be reloaded.

@Kralizek
Copy link
Author

Projects are actually reloaded but some visual cue when a project is reloaded/restarted in the AppHost log would be a nice thing to have.

@DamianEdwards
Copy link
Member

dotnet watch is being updated to better hand Aspire AppHost projects: dotnet/sdk#36971

@ctolkien
Copy link

Is reload supposed to work even within VS right now? We're having to explicitly build again (which restarts all services)

@rcocks-hl
Copy link

@DamianEdwards Has that effort stalled?

@DamianEdwards
Copy link
Member

It depends on what one means by reload. Hot Reload works for supported changes in the app projects but not in the AppHost project. Auto-rebuild and restart of app projects works in VS for app projects when launching without debugging but changes to the AppHost will cause all apps to restart. dotnet watch has been updated to better support Aspire scenarios and will be available in the .NET 9 SDK I believe.

This is a complicated problem which we will continue to make progress on release to release.

@rcocks-hl
Copy link

Thanks @DamianEdwards, I'll try with the .net 9 SDK to see if there have been improvements. It may be that this has worked how I'd expect, but I haven't been aware due to the lack of logging in the console when launching via the apphost. Hopefully the .NET 9 SDK update brings that kind of improvement.

@DamianEdwards
Copy link
Member

Aspire 8.1 added more logging in the AppHost project in that it now forwards logs from the resources being orchestrated. You can of course adjust the logging levels and filters too to see more logs.

@rcocks-hl
Copy link

@DamianEdwards I've tried again with Aspire 8.1, albeit on SDK v8.0.7 and I've been unable to get the message I'm interested forwarded.

In apphost I do now see forwarded messages, but the specific message that would normally be generated when running individually do not get forwared.

For example, running dotnet watch --project .\AspireSample.Web\ and changing Components\Pages\Home.razor. results in a console message:

dotnet watch ⌚ File changed: .\AspireSample.Web\Components\Pages\Home.razor.

And the page is updated live while viewing, without refreshing.

This message does not appear to be a standard ILogger format message.

Launching watch via the appHost however: dotnet watch --project .\AspireSample.AppHost\

And changing the same file.

Does not result in any log, and the change is not "pushed" to the client.

Manually refreshing reveal the change has been hot-reloaded in the background.

I'll test again with the .NET 9 SDK to compare. I'll need to wait until I'm on my home account for that.

@DamianEdwards
Copy link
Member

This message does not appear to be a standard ILogger format message.

Correct. That message is emitted by dotnet watch itself, not your applications.

I'll test again with the .NET 9 SDK to compare. I'll need to wait until I'm on my home account for that.

I believe this should work in the .NET 9 SDK as it has the dotnet watch updates, right @davidfowl?

@davidfowl
Copy link
Member

The work isn't in yet. It's still in a pull request. Track dotnet/sdk#36971

@davidfowl davidfowl closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants