Sitecore 9 Helix Visual Studio File Configuration For Builds

Verify As You Develop

November 17, 2018

## The Helix Way of Building

Sitecore 9 Helix introduced a new way of building and releasing SC projects using Gulp. This new process deviates from the traditional method of using Visual Studio's build in functions. While one can develop solutions and build as desired within Visual Studio, Gulp handles additional tasks that take into account the new paradigm. We no longer build and run the website from the same folder. When we run a Gulp build, the idea is to compile the solution files with MSBuild, and then to selectively copy the necessary files into the website (AKA deploy) directory. When building (gulping) locally, the compiled files are copied into the inetpub folder corresponding to the location of your Sitecore installation. This process is not a comprehensive overwrite of Sitecore files, but rather a selective update of files relating to our features built on top of Sitecore.

Solution File Properties

An important consideration when configuring individual files in our solution is to remember that Gulp ultimately takes the reigns instead of VS. As a result, each file must have its properties verified in order to ensure smooth builds and releases. The table below is not fully comprehensive, but should provide a general understanding of how Helix builds and releases are intended to function.

You will notice that none of the files are copied to the output directory. This is because gulp will handle this task for us. The Build Actions are what's key here as it will dictate to MSBuild as called in Gulp what to do with each type of file.

File TypeBuild ActionCopy File to Output Directory
.scssNoneDo not Copy
.jsContentDo not Copy
.cssContentDo not Copy
web.configNoneDo not Copy
Custom configs (ex. App_Config/Include/SiteDefinition.config)ContentDo not Copy
Custom config transforms (ex. App_Config/Include/SiteDefinition.config.prod-cd.transform)NoneDo not Copy
.cshtmlContentDo not Copy
.csCompileDo not Copy
.mdNoneDo not Copy
Font files (.otf, .eot, .svg, .ttf, .woff, .woff2)ContentDo not Copy
Image filesContentDo not Copy
Any other items that we DO NOT want to deployNoneDo not Copy
Any other items that we DO want to deployContentDo not Copy

Conclusion

Solution file properties are only one consideration when properly configuring a Helix solution. Incorrectly configured files can be hard to spot until releasing. Always be sure to run local release builds in order to inspect the final output of your new solution and additional features on an ongoing basis.