Sitecore 9 Helix Visual Studio File Configuration For Builds

Verify As You Develop

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 Type Build Action Copy File to Output Directory
.scss None Do not Copy
.js Content Do not Copy
.css Content Do not Copy
web.config None Do not Copy
Custom configs (ex. App_Config/Include/SiteDefinition.config) Content Do not Copy
Custom config transforms (ex. App_Config/Include/SiteDefinition.config.prod-cd.transform) None Do not Copy
.cshtml Content Do not Copy
.cs Compile Do not Copy
.md None Do not Copy
Font files (.otf, .eot, .svg, .ttf, .woff, .woff2) Content Do not Copy
Image files Content Do not Copy
Any other items that we DO NOT want to deploy None Do not Copy
Any other items that we DO want to deploy Content Do 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.

Fish