Working in a new demo project called “CMCDSample”, with Visual Studio 2017, I have found a small limitation in “Docker” projects (“docker-compose”) in VS2017, and below I document both the limitation and its solution.
When VS2017 builds (or runs with F5) an original “docker-compose” project of VS2017, it checks if the selected configuration is “Debug”, in which case it searches for a file, inside the project, called “docker-compose.vs.debug.yml” to use it in the build process. If the actual configuration it is not called literally “Debug”, then VS2017 assumes that it is a “Release” and tries to use (if exists), the file “docker-compose.vs.release.yml”.
The behaviour of VS2017 previously described conflicts with the needed of having several configurations of “Debug” for the different roles of the Sitecore server. The logic applied to the build process, makes the configurations “DebugCD” and “DebugCM” build like if they were “Release”, disabling all the functionality needed in a development environment to debug the code.
Fortunately, there is an easy fix that allow us to indicate for each custom configuration, if the build logic “Debug” or “Release” must be applied.
Open the VS2017 solution that contains the project “docker-compose” with custom configurations.
Again, in the “Solution Explorer” panel, right-click on the project “docker-compose (unavailable)” and select “Edit docker-compose.dcproj”. The file “docker-compose.dcproj” will open in VS2017.
Note that there is a sub-element “DockerDevelopmentMode” for each configuration of the solution. The names used in the attribute “Condition” must match each configuration. There must be an element “DockerDevelopmentMode” for each configuration of the solution.
Once modified, the file “docker-compose.dcproj” must be saved and closed in VS2017.
Finally, in the “Solution Explorer” panel, right-click on the project “docker-compose (unavailable) and select “Reload Project”.
My previous blogs about Sitecore and Docker can be found here and here.
Hope this can help someone else. If yes, please let me know by leaving a comment. Thanks!