Setting up a Habitat + Sitecore.Demo Site Locally

I was talking to my mentor Jon recently about Sitecore Ignition and various other topics and he mentioned on how he’s been constantly slammed with work. Jon’s so busy I think he’s forgot what having free time feels like. It’s nice, Jon 😏, free time is nice.

Finding free time is one of my super powers. However, as great as I am at finding time, I am unable to share the time I find. Aware of my powers as Sitecore Superman, Jon asked me for a favor. Since I am happy to help my Sitecore friends and I hate to let free time expire I told Jon I would be happy to help.

In my free time, he requested me to:

Simple request, right? All I need to do is follow the documentation and everything will go perfectly. I feel rebellious, I will hold off looking at the documentation till the end.


Install Node.js

Habitat uses Node.js (version 4+) so you’ll need it. If you haven’t installed Node.js, click here to download.


Install a Sitecore Instance for the Habitat Demo

Using Sitecore Instance Manager or your preferred installation method, install Sitecore Experience Platform 8.2 Update 2 (rev. 161221). If you never had the opportunity to install Sitecore and need instructions, those can be found on the same page as the download.

Install the Following Package

Habitat requires the installation of Web Forms For Marketers 8.2 Update-1


Setting up the Habitat Solution

Clone or download(and extract) Habitat from GitHub to your project directory and then open the solution in Visual Studio 2015*.

*Warning: Using Visual Studio 2017 may cause publishing errors. I unfortunately don’t have the time to dig into this, so I switched back to VS 2015 and everything published as expected.

Restore the Node.js Modules

The easiest(hackiest) way to restore these modules is to modify and save the package.json file OR if doing things correctly is your cup of tea, open the command prompt as an administrator (technical term: open with “elevated privileges “). Navigate to the root of the project and run ‘npm install’ and click enter.

Next, in the configuration folder, modify the following files:

  • gulp-config.js:
    Modify the instanceRoot variable to match the path to your Habitat Sitecore instance.
  • z.Habitat.DevSettings.config:
    Modify the sourceFolder and rootHostName to match your environment.
  • publishingsettings.targets:
    Modify the publishUrl to match your environment.

Restore the NuGet Packages:

We need to restore the NuGet packages for the solution. We have two options that we could use to accomplish this.

  • We could use the old school process of: Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution. In the window that pops up, click restore on the right side of the yellow bar.
  • The other option is to use Gulp. We can run Gulp through the command line 🤢 or we could type less and use the Task Runner Explorer pane in VS. To use the Task Runner Explorer(or as I call it, TRE) in VS, navigate to View -> Other Windows -> Task Runner Explorer or use the shortcut: Ctrl+Alt+Backspace. If the tasks are empty, select Gulpfile.js and click the refresh icon.

ALERT! 😈 ERROR! ERROR…Yay. When I refreshed the TRE I got the following error:

Sitecore Habitat and NodeJS Error – Use of const in strict mode. It’s Visual Studio’s fault!

ERROR SOLVED… Thank you Visual Studio for wasting my time👎🏼. I am not sure why this issue occurred during this setup, I’ve used the TRE sans errors a couple weeks ago. If you have this issue as well, click here for the remedy.

LESSON LEARNED FROM ERROR: Reading the comments to the original question on Stackoverflow sometimes can be more beneficial than the answer.

Restore Nuget Packages Attempt #2: Double click on 02-Nuget-Restore. That worked 👍🏻.

FYI, running the default task will execute all the configuration and building tasks for the solution. If an error occurs, like above, you can run the tasks individually until the issues are resolved.

Everything deployed successfully. I won’t cover creating the Sitecore Packages,that’s basic Sitecore 101… maybe 102.


Setting up the Sitecore.Demo Solution

Clone or download(and extract) Sitecore.Demo from GitHub to your project directory and then open the solution in Visual Studio 2015. The projects in this solution have references to the following Habitat projects:

  • Sitecore.Foundation.Alerts
  • Sitecore.Foundation.Assets
  • Sitecore.Foundation.Dictionary
  • Sitecore.Foundation.SitecoreExtensions
  • Sitecore.Foundation.Theming

It’s up to you how you want to handle these references.

  • Option 1: Add the Sitecore.Demo projects to the Habitat solution or vice versa.
  • Option 2: Move the required Habitat assemblies over to a lib folder in the Sitecore.Demo solution.
  • Option 3: Take a chance and choose the mysterious third door🤔!

Restore the Node.js Modules

Open the command prompt as an administrator with elevated privileges. Navigate to the root of the project and type ‘npm install’ and click enter.

Next, in the configuration folder, modify the following files:

  • gulp-config.js:
    Modify the instanceRoot variable to match the path to your Habitat Sitecore instance.
  • z.Sitecore.Demo.Legal.Website.DevSettings.config
    Modify the sourceFolder to match your environment.
  • publishingsettings.targets:
    Modify the publishUrl to match your environment.

Restore the NuGet Packages:
We need to restore the NuGet packages for the solution. We have two options that we could use to accomplish this.

  • We could use the old school process of: Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution. In the window that pops up, click restore on the right side of the yellow bar.
  • The other option is to use Gulp. We can run Gulp through the command line 🤢 or we could type less and use the Task Runner Explorer pane in VS. To use the Task Runner Explorer(or as I call it, TRE) in VS, navigate to View -> Other Windows -> Task Runner Explorer or use the shortcut: Ctrl+Alt+Backspace. If the tasks are empty, select Gulpfile.js and click the refresh icon.

Install Modules Required by Sitecore.Demo

After initially trying to do every without referring to the documentation, I ended up needing to look at the Sitecore.Demo to solve syncing issues. Following the Sitecore.Demo readme, I downloaded and installed the following modules:


Syncing Issues and xGenerator

Still researching this and will update this post once I have more details.

I wasn’t able to use Gulp in Visual Studio to sync Unicorn for some reason. It didn’t error or provide me with any clue for me to follow in hopes of solving that mystery. I ended up having to go to /unicorn.aspx and sync from there. Synce everything in Habitat and then sync Sitecore.Demo.

Installing xGenerator is extremely frustrating. It’s the last thing I need to do and I am running low on patience. I had to guess which version I needed to install. Since everything else supported Sitecore 8.2 update 2, I decided to switch the branch to release 8.2. Unlucky everyone, there isn’t a Sitecore package for easy installation like on the master branch. This is becoming a longer task than I expected. I needed to clone this branch, set up gulp and let Unicorn loose to do it’s syncing. Both Habitat and Sitecore.Demo were easy to setup, publish and sync; xGenerator has to be difficult for whatever reason👎🏻😡 🤕.

After a lot of time spent on the xGenerator I finally got the Sitecore.Demo and the xGenerator items to sync without error. There is probably a different way to get this working, but I downloaded the xGenerator solution from GitHub. I had to fix a lot of references. I moved the serialization configs to the Sitecore.Demo project in that layer and moved the corresponding serialization items and placed them with the others. I updated the path in the configs and went to the Unicorn.aspx page and did another sync. Sign more issues. I decide to also install the Sitecore Package xGenerator zip found on the master branch.


Overall, setting up a Helix Demo Site is not a time consuming, horrible experience. I would describe it as pleasant and relaxing. I was able to set up Habitat and write the majority of this post without looking at the official Getting Started instructions. Those are better than my instructions from this post so you should take a look if you’re curious.

Sitecore.Demo and xGenerator is where the trouble begins. Hopefully if you attempt this it will go more smoothly than it did for me.


Other Issues and Errors

Issue: The installation instructions for the PXM are incorrect. It says to add the log4net section to the web.config
Solution:  Add that section to Sitecore.config.


As usual, thank you for reading, I hope you learned something, if not, I hope you were at least entertained.

Did I miss anything or get something incorrect? If I did, apologies… leave a comment below and I will correct the mistake(s).


Do you enjoy my oddly themed blogs and wish you had access to even more of me and my ideas? Good news, you’re in luck!

If 140 characters is your thing, follow me on Twitter.


If you hate reading and watching Sitecore videos entertains you, head over to my YouTube channel! Sometimes I entertain, sometime I provide useful Sitecore information and sometimes I can do both in the same video.


I can also be found hanging out on the Sitecore channels on Slack, I like it, although it occasionally triggers AOL chat room flashbacks from the olden days.


You can also find me adding content on LinkedIn and on Reddit.