I have a .NET 6
web API project that uses Hangfire
in the background. When I debug the project from VS2022
I would like to open both the swagger UI
and the Hangfire
dashboard in separate tabs when the browser is launched. Is there any way to accomplish this within launch profiles or elsewhere?
I tried adding multiple Url's to the Url
setting within launch profiles for the project (note NOT App Url
). That seemed like the logical place to do it, but it didn't work.
Update: I have submitted this as a VS feature request.
You can implement this feature by using .bat
file like below.
open_another_page.bat
Find the port num from launchSettings.json
file.
@echo off
timeout /t 5
start "" "https://localhost:7075/Home/Privacy"
Add below setting in your .csproj
file.
<Target Name="PostBuild" AfterTargets="Build">
<Exec Command=""$(ProjectDir)open_another_page.bat"" />
</Target>
And we need to change post-build event settings to Always
.
Screenshots in my side