We are all excited about Sitecore 10 and the direction the platform is taking towards .Net Core and Headless. However the task of updating your existing solution to conform to the new headless approach, might seem overwhelming.

Sitecore 10 Headless is now split to into two project types, Platform and Rendering Host.

Platform

Platform is specific to Sitecore (CM), and only configurations and code directly related to either extending or configuring Sitecore should exist here.

Rendering

Rendering (Rendering Host) is specific to the Application and should contain all code and configurations required for the application to run.

Helix

Following Helix conventions you’ll now most likely need to have two projects (.csproj) per module. See Hero example below;

  • Helixbase.Feature.Hero.Platform – .Net Framework
  • Helixbase.Feature.Hero.Rendering – .Net Core

Making the Move to Headless (NetCore)

Updating an existing Helix MVC solution the new Headless approach is a time consuming task. I have written a Powershell script to take some of the pain away.
Simply run the script within a Helixbase solution from the ./tools directory and it will update your solution ready for Headless development.

Before Running

  1. Update the variable in the script $solutionName to match you solution name, if its not equal to Helixbase.
  2. Close the solution
  3. Execute Powershell script with elevated privileges (Admin)

The script will perform the following tasks:

  • Converts all existing Helix modules into Platform relative projects, updating the Framework reference to .Net Framework 4.8
  • Creates a new Rendering .Net Core project for each Module (Includes nuget packages for Rendering Engine and Layout Service)
  • Updates any (HPP) Helix Publishing Pipeline projects and sets them to only work with Platform modules.
  • Creates a new Rendering Host .Net Core web app along side the HPP site.
  • Updates all namespace reference to meet the new naming conventions of SolutionName.Layer.Module.Platform and SolutionName.Layer.Module.Rendering

On Completion

Once complete open the solution and you’ll see changes to each module. See below

You now have a solution that is ready to start being used for Headless development. All of your existing code is in the Platform (CM) project, you will now need to decouple this, moving the application over to the Relevant Rendering project.

Rendering Host

The rendering host project will need configuring and setting up as the script currently only generates a vanilla .NetCore Web App. You can use Sitecores documentation as guide for this here or check Helixbase Headless for an example. Helixbase headless is currently work in progress but I intend to have the Rendering Host available shortly.

Download

Get the scrip here

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: