A Sitecore solution is comprised of many moving parts and there are some steep barriers for the non-.NET developer members of the team to get up and running.

To help solve this problem, our Keystone for Sitecore accelerator now includes a Windows installer that can provision a Visual Studio solution, install the necessary packages in Sitecore and assist new team members in getting up and running. Here is how we did it.

Goals

We started with a few basic goals:

  1. Setting up a new Visual Studio solution specific to my solution, including TDS should be easy
  2. I should not need to worry about installing modules or items
  3. Whatever the install process, recognize that different teams will have different conventions

The How

The end result of a variety of experiments was a Windows installer** that could guide the user in the setup of a new or existing solution. 

Automate complex installs with PowerShell, Sitecore PowerShell, and NSIS

** We started with bare PowerShell scripts, but as PowerShell is not a comfortable interface for all team members we decided the little additional effort of an installer was worth it. 

The installer was produced using NSIS, PowerShell and PowerShell for Sitecore.

To understand what is going on, let’s unpack the contents a bit. Inside the installer is:

  • A templated Visual Studio solution
  • Minimal install of PowerShell for Sitecore
  • Full install package for PowerShell for Sitecore
  • Keystone .update packages containing items and files

When the install runs with the Visual Studio option the solution is extracted to the disk in the desired location, projects are renamed and TDS projects are updated with the appropriate URL bindings. No messing with build configurations.

Automate complex installs with PowerShell, Sitecore PowerShell, and NSIS

Automate complex installs with PowerShell, Sitecore PowerShell, and NSIS

Automate complex installs with PowerShell, Sitecore PowerShell, and NSIS

With basic information: source directory, IIS site and binding and solution name the installer can proceed. Standard Windows PowerShell commands are first used to install the minimal PowerShell for Sitecore. As this requires no items, it is just a file copy. The file copy is also used to place the needed packages and update packages in the appropriate Sitecore directories.

Once the minimal version of PowerShell is installed PowerShell remoting is used to install the packages. The functions we use for this are below.

Automate complex installs with PowerShell, Sitecore PowerShell, and NSIS

When the installer completes the user would then quickly validate that the solution setup was successful and commit the solution to source control. From that point forward each new team member to setup the solution would do a get from source control and then run the installer with the second option to initialize their Sitecore installation.

Tip: PowerShell for Sitecore 4.0 has a bug that produces a false error on long running remote script jobs. This is why you why you see the odd Write-Host command warning an error may be thrown. To ensure package installation was actually complete our scripts did a further remote check for Keystone items in the files system and content tree. If their presence was not found the user would be notified.

I hope this post inspires others to consider ways to make the Sitecore setup process easier.


comments powered by Disqus