Discussing a small limitation found in Docker projects in Visual Studio and ClearPeople's solution to it

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. 

Limitation of original “docker-compose” projects in VS217 

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 project “CMCDSample” shows how to manage two Sitecore servers with different roles (“Content Delivery” and “Content Manager”) inside a development environment. This solution of Visual Studio needs a configuration for each role server of Sitecore. At the same time, each one of those roles needs a “Debug” and “Release” version. In conclusion, we need the following configurations: 

  • DebugCD 
  • DebugCM 
  • ReleaseCD 
  • ReleaseCM 

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.

The steps detailed below describe how to fix it:

  1. Open the VS2017 solution that contains the project “docker-compose” with custom configurations.
  2. In the “Solution Explorer” panel, right-click on the project “docker-compose” and select “Unload Project”. The project will show up in the “Solution Explorer” panel as “docker-compose (unavailable)”
  3. 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.
  4. Inside the file “docker-compose.dcproj” search the element <PropertyGroup Label=”Globals”> and then from its last label (</PropertyGroup>) add the following element “PropertyGroup”:
    <PropertyGroup Label=”Custom”> 
    <DockerDevelopmentMode Condition=” ‘$(Configuration)’ == ‘DebugCD‘ 
    <DockerDevelopmentMode Condition=” ‘$(Configuration)’ == ‘DebugCM‘ 
    <DockerDevelopmentMode Condition=” ‘$(Configuration)’ == ‘ReleaseCD‘ 
    <DockerDevelopmentMode Condition=” ‘$(Configuration)’ == ‘ReleaseCM‘ 
  5. 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.
  6. The values of the nodes “DockerDevelopmentMode” indicate how each configuration must be treated:
    1. Fast: Debug
    2. Regular:Release
  7. Once modified, the file “docker-compose.dcproj” must be saved and  closed in VS2017.
  8. 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! 

Author bio

Benjamin Moles
Benjamin Moles
Sitecore Developer
My goal is to return happiness to clients' faces by getting their issues and questions solved. As a Technical Service Manager I provide the required resources to support clients' applications and infrastructure. I also enjoy playing with remote-controlled helicopters.


comments powered by Disqus

Related Articles

Sign up to our ClearThought newsletter

Get inspired and learn something new by subscribing to our FREE newsletter. It’s full of ClearPeople's thought-leadership whitepapers, blogs, events, and much more. We promise to not use your email for spam.

Closing this message and/or accessing our website tells us you are happy to receive all cookies on the ClearPeople website.
However, if you would like to, you can change your cookies settings at any time.