Use custom Visual Studio startup configuration using Docker

I'm going to create a .NET Core project with Docker in Visual Studio 2017. I created a project and added dockers to the solution, and everything works.

But somehow VS will not create and launch Docker with any configurations except Debug and Release.

I created a solution and project configuration called Preproduction and selected it, and also created a docker-compose.vs .preproduction.yml file.

But when I run the preset, the project works as if Release was selected. The Build Output console also shows the following:

Debugging

*docker-compose -f "docker-compose.yml" -f "docker-compose.override.yml" -f "docker-compose.vs.debug.yml" -p dockercompose3979710767*

Release

*docker-compose -f "docker-compose.yml" -f "docker-compose.override.yml" -f "docker-compose.vs.release.yml" -p dockercompose3979710767*

Preparation of production

*docker-compose -f "docker-compose.yml" -f "docker-compose.override.yml" -f "docker-compose.vs.release.yml" -p dockercompose3979710767*

Pay attention to the second yml file. Somehow it uses the release file, not the custom configuration file that I added.

- , , ?

+4
2

, . , , , DLL. , "DEBUG", "RELEASE".

docker-compose.yml , , Docker, -, . , Dockerfile, .

, script, .

0

. : 1) dnSPY (https://github.com/0xd4d/dnSpy/releases)

2)

3) Microsoft.Docker.dll( C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\tools).

4) (, - ).

5) dll dnSpy.exe

6) Microsoft.Docker( ) → Microsoft.Docker.dll → DockerComposeClient → MergedDockerComposeDocumentProvider → GetDocuments

7) ,

8) RightClick → IL

9) , ( docker-compose.override.yml docker-compose.development.yml)

10)

11) → DLL.

WHOILA!!! VS , , . .

0

Source: https://habr.com/ru/post/1678239/


All Articles