Provide a way to launch the browser when running `dotnet run`
See original GitHub issueIt would be great if there was a way to run an ASP.NET Core app from the command line using dotnet run
and have the default browser launch at the right URL. CLIs for other platforms let you do this. For example, with the Angular CLI you can do ng serve --open
to both run the app and open the default browser.
This would be particularly useful for projects that you created using VS, which generate random ports for the server URLs.
There are already launchBrowser
and launchUrl
properties the launch profiles in launchSettings.json
that let you specify that you want this behavior in VS.
We would also want this to work with dotnet watch
without having the browser pop up multiple times, which may require some coordination.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:44
- Comments:28 (17 by maintainers)
Top Results From Across the Web
asp.net - Run app and launch browser from command line
I don't think dotnet can start a browser. It will just start the server and use the applicationUrl and environment variables but will...
Read more >dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code with one command.
Read more >How to suppress dotnet whatch run to open a browser
Using the launchSettings. The launchBrowser property in the profiles defines whether the browser should be opened or not. Set it to false in ......
Read more >Don't Launch a Browser Running ASP.NET Core Back-end ...
This is going to be a quick post on how to stop that browser launch. The following are the previous Web Template Studio...
Read more >Run and debug .NET Core and ASP. ...
Using launch settings (launchSettings.json) to run and debug .NET Core apps in JetBrains Rider.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have to support https://github.com/dotnet/sdk/issues/9038#issuecomment-656351718
Working with Blazor WASM on Linux (where firefox often is the default browser for good reasons:
xdg-open
will use firefox`) is not easy out of the box, when Chrome is the only supported dev browser (on Linux).My current solution is to use 2 terminals
Terminal 1
Terminal 2
One strange thing is that I can’t seem to get this to work with
dotnet watch
. That isTerminal 1
does use the default
launchSettings.json
(launchBrowser
,inspectUri
,applicationUrl
etc) config values for the app, I have no idea why the childdotnet run
is not getting the--no-launch-profile
switch??? May be my mistake???REQUEST:
Add new
browsers
field with possible valuesfirefox
,chrome
,edge
etc. tolaunchSettings.json
NOTE: Each opened browser should probably also have config values for extra args. I guess this all starts to be a bit platform dependent, but a design should be possible accross windows, macos and the dotnet supported linux distros.
+1