Set Up a Development Environment for Sitecore XM Cloud 10

With Containers and ASP.NET Core Rendering SDK 

March 28, 2023

There are multiple steps to set up a development environment related to Sitecore XM-Cloud 10.3. This guide will cover the process up to getting to the launch pad, including:

PowerShell 5.1

Download PowerShell.

If you are using Windows 10 Anniversary Update or Windows Server 2016, you should already have Windows PowerShell 5.1.

Node Environment

First, install Node Version Manager. You will use this to install any version of Node for your projects.

  • Download Node Version Manager here.
  • After downloading the .zip file, open the file from your Downloads folder as an administrator and follow the instructions.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • After installing PowerShell 5.1 and NVM is complete, open PowerShell as an administrator and run NVM in the PowerShell command prompt. You should see information and NVM commands.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Now, run NVM install @. For the Sitecore XM Cloud 10.3, node v18.13.0 is preferred.

Command:

 nvm install @18.13.0

Hyper-V in Control Panel

Navigate to the control panel from your windows bar menu and search for “Turn Windows features on or off.” By default, the Hyper-V should be unchecked. Check it and click ok.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Docker 4.11.1 - Download Here

On the download page, select your system OS and follow the instructions.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Once you have docker 4.11.1 installed, launch it and uncheck Use Docker Compose V2 and check Use the WSL 2 based engine.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Ensure that you have Docker Desktop installed (see image below) and that Windows containers are enabled. If the docker tray icon reads, Switch to Windows Container..., select the option and wait for Docker to switch to Windows containers from Linux. Any previously running Linux containers will stop and cannot be started while Windows containers are enabled.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

If the right-click menu for the docker tray icon reads Switch to Linux containers..., you have Windows containers enabled and are good to go.

Bringing it All Together

  • Check your docker is on windows containers and that docker is launched.
  • Check your Hyper-V is enabled/checked.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Local Installation of XM Cloud

Once you have your project from either the official GitHub repository or Sitecore Cloud Portal, in your PowerShell terminal, cd into the project directory: In my case, I have:

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • Run
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All command.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • After running, you should have the below:

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • Run in the terminal
iisreset /stop

There is a likelihood of running into this error. Two things could cause this error.

  1. How you write iisreset /stop command. There is a space between the keyword iisreset and /.

  2. Internet Information Services in Turn Windows features on or off are not checked.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • The solution to the error is to ensure Internet Information Services is checked in Turn Windows features on or off and spell the command - iisreset /stop correctly.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

  • Before running .\init.ps1 -InitEnv -LicenseXmlPath "<c:\path\to\license.xml>" -AdminPassword "", if this is your first time, your workstation will be entirely new and the execution policy is still restricted. Running the execution policy command will update the execution policy right.</c:\path\to\license.xml>
Set-ExecutionPolicy -Scope CurrentUser Unrestricted

Change the values in the angle brackets “<>” AdminPassword = “b” and the path is license.

You need to create a folder in the same directory you have in your project file and call it license. Save the license.xml file inside.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

.\init.ps1 -InitEnv -LicenseXmlPath "C:\license\license.xml" -AdminPassword "b"

Run and say yes “Y” to all.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

If all has been done correctly, the screen below should appear. All appropriate certificates should be installed.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Note the bottom message in turquoise green text. You must set this variable if you haven’t done so already.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

If you reach this stage, you have completed the initialization process, and the up command can be executed.

Important: If you get an error running the up command, run the down command to stop/remove all the containers supporting the Sitecore environment.

./down.ps1

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

The up script is designed to build and start the containers for the environment. It also checks if the device is authorized through the identity server and de-serializes the Sitecore items.

The up command creates the containers and de-serializes the sample items into the Sitecore instance using the new Sitecore content serialization CLI.

./up.ps1

At this point, wait for the up command to run through.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

You will be prompted to do a device confirmation, click the confirm button.

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

If you finally got here. Congratulations, all connected!

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up

And your project should be connected to the Sitecore page XM Cloud. Your browser should pop up and display the Sitecore launch pad:

Developer Environment - Sitecore 10 With Containers and Asp.net Core Rendering Sdk - Visual Set-up