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

Dotnet Watch: decouple browser launch and refresh #28885

Closed
wants to merge 1 commit into from

Conversation

zbecknell
Copy link
Contributor

Summary of the changes

  • Decouple browser launch and browser refresh for dotnet watch run
  • Fixes missing colors when launchBrowser: false in launchSettings.json and still allows automatic browser refreshing using

Addresses #25317

@ghost ghost added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Dec 28, 2020
@zbecknell zbecknell changed the title Fix 25317 Dotnet Watch: decouple browser launch and refresh Dec 28, 2020
@mkArtakMSFT mkArtakMSFT added community-contribution Indicates that the PR has been added by a community member feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) labels Dec 28, 2020
Base automatically changed from master to main January 22, 2021 01:33
context.ProcessSpec.EnvironmentVariables["DOTNET_STARTUP_HOOKS"] = pathToMiddleware;
context.ProcessSpec.EnvironmentVariables["ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"] = "Microsoft.AspNetCore.Watch.BrowserRefresh";
}
var pathToMiddleware = Path.Combine(AppContext.BaseDirectory, "middleware", "Microsoft.AspNetCore.Watch.BrowserRefresh.dll");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zbecknell for the PR. The worrying part of this change is that it will by default inject an ASP.NET Core middleware in every app that's launched by dotnet watch. If we were to consider a change, we need a better signal to indicate that you want the refresh but not the browser launching. The env variable isn't well advertised so I wouldn't consider that as a reasonable option.

@zbecknell zbecknell marked this pull request as draft March 13, 2021 09:20
@pranavkm pranavkm closed this Mar 25, 2021
@rcdailey
Copy link

What nuget package and release version is this in? I'm not getting browser refresh with launchBrowser set to false. Using Blazor Server.

@ghost
Copy link

ghost commented Jul 11, 2021

Hi @rcdailey. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI community-contribution Indicates that the PR has been added by a community member feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants