Sitecore Helix Principles | Ayman Elbadawy

Layouts, Renderings, and Placeholders

Data Templates

The project, Feature, and Foundation Layers

Visual Studio Folders Structure

Folders Structures

  • Create the same folders physically on your drive under the projects folder you created in the first step. Under the project name of your solution, create a Source folder then, inside it, create the 3 folders: Project, Feature, and Foundation. Make sure no other folders exist (i.e. the default project created by Visual studio etc….)
  • Following Helix principles, projects within your solution must adhere to the following structure:
  • Project naming convention: [Solution name].[Project Layer].[Project Name]. So for example, if you create a solution named Demo and you want to create the configuration project for it, then the full name will be as following: Demo.Foundation.Configuration.
  • Also, you should save physically this project as follows:
  • Under your solution folder, go to the Foundation folder. Create a new folder and name it Configuration. Inside it, create a new folder and name it code. Then you can save your project there. The Final Path will be:

Helix Structure Benefits

Project settings

  • To avoid corrupting your Sitecore main installation, make sure that all references are not copied when the project is published. This will prevent overriding the main dlls in the target Sitecore website. You can do that by selecting all your reference and set copy local to False.
  • The Configuration project is necessary for any Sitecore project. In this project, you will store your configurations and Database connection strings. To create them, Copy the Web.config and ConenctionStrings.config from the main website to your new project. This must be under the Configuration layer. By default, you will copy the configs from the paths: [wwwroot\[YOUR_SOLUTION].dev.local\web.config] and [wwwroot\[YOUR_SOLUTION].dev.local\ App_Config\ ConnectionStrings.config]
  • When you create a new MVC project, make sure to delete all unnecessary folders and files: App_Data, App_Start, Content, fonts, etc….
  • For any new project except the Configuration project under the foundation layer, make sure that the web.config both in the webroot and under Views folder are not deployable to avoid breaking the main Sitecore installation. To do that, right-click your web.config and set Build Action to None, and set Copy to Output Directory to Do not copy.

Sitecore Kernel and Sitecore MVC

  • Under the Feature layer, your projects will need to install Sitecore Kernel and Sitecore MVC. You can do that by using the NuGet Package Manager (NPM). Right-click your project, select Manage NuGet Packages. You must have Sitecore Package Source saved there. If not, click Settings, add the new name, and the source URL which is: https://sitecore.myget.org/F/sc-packages/api/v3/index.json
  • Also, make sure you are installing the package version that is compatible with your solution. Remember after installing the 2 packages to go to the installed references and set copy local to false as explained above! Also, to enable IntelliSense for your project views, go to the web.config under the Views folder and add Sitecore MVC namespace.

Managing Dependencies using Helix Principles

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store