I have a C# project which I am editing in visual studio. When I click the green start button, it builds the project, starts IIS and then opens a browser window.
If I wanted to customise this behaviour, for example to also launch an nginx reverse proxy which sits infront of IIS, how would I do this?
I would also be interested in which pieces of technology are involved in the process between clicking the start button and my browser window opening.
A lot of things happen when you click the "green button". The main are:
I assume you're only interested in customizing the 4th step. Click on the little downwards arrow next to your "green button" to open the context menu, click Browse With...
.
.
You can there select from a list of web clients which Visual Studio detected. Click Add...
, you'll be presented with a window to add your own client. There you can point Visual Studio to aything - nginx, a custom launcher that you can easily make with C# (Which could, as in your example, start nginx, or perform any kind of action), a PowerShell script, etc.
Note: The last argument passed to the application will be your project URL, any other arguments you add will be prepended before it. If you leave your arguments empty, it will still pass your project URL as the only argument.
A cleaner solution would be to write a Visual Studio plugin, although I don't know much about it - if you decide to go down this route you can begin your research here.
Not sure if this is relevant to you, but you can also select which IIS server Visual Studio should publish your project to. Go to your project Properties > Web, under Servers you can select your target IIS server and project URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With