Project “docker-compose” and VS2017 configurations

Posted 18 June 2018 12:00 AM by Benjamin Moles, Senior Developer @ ClearPeople

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! 


Add your comment





intranet Modern SharePoint teamwork employee engagement digital workspace SharePoint JavaScript Windows Azure Digital Transformation staff satisfaction productivity Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics jquery QA Quality Assurance testing content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath