Sunday, December 16, 2018

Debugging Multiple Projects in Visual Studio 2017

Hi,

Been a long time so here it goes -- debugging multiple projects

If you look around a lot you will eventually find this

https://docs.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2017

But actually, you can't do that well



Crunchify.com - RESTful Introduction
(the most important picture in the world my friends Java but I liked the picture)

So here is what you do, if you want to debug dotnet core webservices

* You publish in debug mode to folder
* Startup the project after setting ASPNETCORE_ENVIRONMENT variable

(Do PowerShell for powers)

* Now startup your web project / console program / whatever is going to contact the service in Visual Studio
* Now back to OLD SCHOOL and ATTACH TO PROCESS

(I know, greatest window in the world)

So it's a little pain in the ass to get it to work especially if you debug a lot. Attach to process every single time. But the key is dotnet core comes with its own webserver (Kestrel). You don't need IIS anymore and you don't need IIS Express anymore.

I am sure there's some crazy way to get it working with IIS / Visual Studio integration, remote debugging, etc., etc., but this way works and doesn't involve downloading a half dozen things and configuring IIS (which is half the point of dotnet core, lol). It also gets you ready for the day everything is on command line and you don't need Visual Studio (yeah, right).

Happy Coding