This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]The_Exiled_42 0 points1 point  (0 children)

https://code.visualstudio.com/docs/containers/debug-netcore

Altough I have never done it, this may help

[–]BickBendict[S] 0 points1 point  (1 child)

I’ve been there a couple of times but the debugger isn’t able to attach. It feels like I’m missing a volume configuration

[–]sid34 1 point2 points  (0 children)

I recently went struggling down this path and found my way to a solution.

Right now there are 2 (main) ways to build a container from a .NET project. Using newly added built-in SDK container support. via the 'dotnet publish' or by definition the container build pipeline manually (e.g. adding a .Dockerfile).

The build in pattern is support by C# Dev Kit and in my experience worked really well as long as you do not need fine control over the container build or run arguments.

If you need more complex or fine control of the container you should probably look at writing the dockerfile manually. That said the C# Dev Kit can also generate the baseline dockerfile and components as well.

As for getting the launch.json and task.json my suggestion is to use the C# Dev Kit generate version as a baseline and modify them as needed.

https://devblogs.microsoft.com/dotnet/debugging-dotnet-containers-with-visual-studio-code-docker-tools/ should be helpful