Setup First Sitecore Helix Example From Scratch (Blank solution)
A quick walk through of
Sitecore helix on how to setup a Sitecore website based on Helix
Architecture
from scratch/blank solution
There is two solution to start with Helix:
a. First to download the
habitat demo site, cleanup and rename the project as per the requirement of the
Project, and start working on the top up of the habitat.
b. Second, create the solution
from scratch means from blank solution.
I always preferred the
second approach, because we can have full control of the solution and no need
to understand the existing site logic and complexity.
So with the consideration
of approach 2, here we are going to setup the site from scratch using Helix
principle.
Hope you already have gone
through the Sitecore helix principles, habitat documents, and training.
There was a lot of
confusion regarding the Helix and Habitat terms, is it architecture? Principle?
design? Sitecore accelerator, what exactly is it?? It was a big question mark
in the Sitecore community when Sitecore introduced this in the September 2016.
Helix is a set of overall
design principles and conventions for Sitecore development.
Habitat is a real Sitecore
project implemented on the Sitecore Experience Platform using Helix. It is an
example that allows
developers to see how Helix is applied and lets developers experience a project based on these principles.
I am not going to
explaining in detail what is helix and habitat?
Refer the below Sitecore
helix documentary link for more details:
Helix is all about the
structure, structure, and structure, Helix says to split your solution into the
logical and physical structure.
Everything thing is a component here.
“A Visual Studio solution
can host a number of different project types, such as Web Application projects, unit test projects, Team
Development for Sitecore (TDS) projects, behavioural testing projects, Xamarin projects, etc., but modules
are always grouped by their logical connection to a module – and never by
type.”
On the very high level,
implementation point of view, I divided the solution into 2 Main categories as
below:
Physical Structure: Create
file system structure (physical structure)
Logical/Virtual Structure:
Create Visual Studio Solution structure (logical Structure)
Logical Structure – Solution Structure
For maximum
discoverability, the structure of the Visual Studio solution must represent the
layer
an module structure, i.e. have
solution folders for Project, Feature and Foundation layers and separate
solution folders for each module. If
there are any additional grouping of modules, these can havetheir own solution folders.Then I set up the folder
structure inside Visual Studio, adding the Project, Feature and Foundation
folders. Solution folders are
virtual, not physical.
So let’s start one by
one to create helix example.
1.Create a website folder in your local drive
where you want to setup Helix
Example once you created folder the come in Visual studio.
2. Go in visual studio and create blank solution
and choose location website
folder which is created recently and put name HelixExample.
Once you created successfully then its looks like.
3.
Go in solution and right click on HelixExample and create 3
folder.
a.
Feature
b.
Foundation
c.
Project
4.
Now create the multiple modules under:
Foundation, Feature, and Project layer
5.
Once you created folder then add folders under
the every folder. Refer images
6. So our folder structure are ready and going to
create project in every folder so click on website folder and empty project.
a. Here we need to take care path and folders name.
b. For project name we are set code name and location we
have to add src/Project/Website.
So that its create a right location.
7. Once you created successfully then its looks
like so now we need to change name for the project to make proper helix architecture.
Click on code
solution and put the name HelixExample.Project.Website.
once you change the name then its looks like.
And also we need to change one more field. Go
in HelixExample.Project.Website
properties and change the assembly name
and default namespace.
8. Now go foundation and feature folder and do the
same step to create project and one more thing we have to disable web.config for build
purpose in every project.
9. Select web.config and go in properties and choose build action
content to none and save it.
Now your solution looks like and also go in your website
folder and you have seen folder structure as per helix.
10. Now its complete and we need to add
configuration part for publish all the code in our root folder. so let’s start
to setup Gulp.
Go this URL and download Habitat repository
https://github.com/Sitecore/Habitat
Once download finished then copy below
file/folder and paste under the HelixExample folder.
Now your website folder have all the files
which required to setup gulp.
Before go ahead check your machine for node.js. if not installed then you have to install node.js. you can download latest version below link.
Once you done installation part then Open cmd as a administrator mode and run
command
When you run the command then its
downloaded all the required file and stored under the helixExample folder. once
finish this command open your solution in visual studio as a administrator mode
and you see gulp file under the task runner.
Open your task runner (short cut key) ctrl+shift+backspace
I hope this article will help you to
understand the basic setup of sitecore helix project from scratch. This is the basic idea for more details and more clarification please visit below URL.
https://helix.sitecore.net/introduction/what-is-helix.html
if you have any concern please put comment.
Happy Coding😇
Excellent
ReplyDeleteIf possible explain about interfaces along with glass.mapper?
ReplyDeleteyou can go through below url
Deletehttp://saddamgour.blogspot.com/2020/02/what-is-glassmapper-and-how-to.html