/ web api

Azure Dev Spaces and Kubernetes Orchestration Support option in Visual Studio 2019

It's been awhile but this one is important. Mostly because it frustrated me so much.

When you right click on an ASP.NET Core project and Add>Container Orchestrator Support and add Helm Charts/Kubernetes then also add Docker Compose support, it seems that the default action for VS2019 is to push your F5 experience to Azure Dev Spaces. While this is pretty cool from a development experience perspective (especially leveraging the power of a distributed platform - I didn't realize you could compose to it [shrugs]), it isn't for everyone and honestly shouldn't be the default. This whole having to untangle Azure from VS is getting old. I enjoy template features like this. If you're like me and cannot develop external to your company network, this is how you eliminate this problem:

Replicate the problem:

When you start a new ASP.NET Core project and add Docker support, you get a Dockerfile by default to begin developing. If you have multiple containerized projects with Docker support, you typically opt to also add orchestration support. Let's replicate this:

  • Start a new Web API project in Visual Studio 2019 with Docker support enabled
  • After loading up, right-click your project and Add>Container Orchestrator Support from the context menu.
  • Click the drop-down to select Kubernetes/Helm and hit OK

This provisioned Helm charts and Azure Dev Spaces yml file. Also, notice your F5 is Azure Dev Spaces!

  • Add Docker Compose support

This provisioned Docker Compose files and updated your F5! Write once, deploy anywhere!! Try to F5 your project and notice you get Azure Dev Spaces prompt. Because you switched to Docker Compose and it exists as a separate project, you only have one debug option.

Solution:

  • Right-click your API project and go to Properties
  • Head down to Debug
  • Switch back to Docker

That's it. It's not clearly evident because of how Docker Compose is handled in VS. Perhaps I'm missing something further. Unfortunately, I spent more time on this than I should have!

As always, I hope this helps someone else out there! Drop me a tweet on Twitter @bitobrian if it did.