Installing SiteCron through NuGet and Configuring

watch-header2Last week I needed to run a Job to perform a daily task within Sitecore so I decided that SiteCron would be the perfect fit for this. SiteCron allows you to run Jobs on a schedule within Sitecore using Cron expressions (under the hood it uses Quartz.NET). I’ve used SiteCron on 3 or 4 projects in the past and really like how reliable and configurable it is for these kind of requirements.

Each time I install it though I forget the steps (especially if doing it via NuGet) so I thought I’d give an overview of this below, including the Unicorn config I used.

Wait, where is the SiteCron version for Sitecore 9+?

Unfortunately the latest version at the time was 3.4 which was compiled against .Net 4.5.2 for Sitecore 7 – 8.3.
The client I was working with use Sitecore 9.3 which requires .Net 4.7.1.
So I compiled a new version (3.5) from the Source on Github for Sitecore 9.3 and created a Nuget package. I noticed that João Neto had also created a branch with an upgraded version that should work with Sitecore 10.1 so created a NuGet package for that too (3.6). Akshay (who created SiteCron) kindly uploaded them to NuGet for me.

sitecron-tweet

What version of SiteCron should I use and How do I install it?

You can download Sitecron from the Marketplace however only 3.2 is released there currently. So I’d advise you install it from Nuget instead. Also generally this is a better way to manage the installation and deployment of Modules in Projects.

Here are the versions of SiteCron you should install for each Sitecore version:

  • Sitecore 7-8.2 –> use SiteCron 3.4
  • Sitecore 9.1-9.3 –> use SiteCron 3.5
  • Sitecore 10.1 –> use SiteCron 3.6

    What about Sitecore 9.0 and 10.0?
    – well 3.4 might work with Sitecore 9 and 3.6 may work with Sitecore 10 but I’m not sure, I’ve not tested them.
    If you try them and they don’t work please pull the source, update the .Net version and compile one or let me know and I’ll try and help.

Install Process via NuGet and Unicorn

  1. Within the project you want to install Sitecon in, either use the NuGet package manger in Visual Studio or run the Install-Package command with the version you need:
    Install-Package SiteCron -Version 3.5.0
  2. Once you’ve installed the package you will see the following have been installed in your project:
    +---App_Config
    | \---Include
    | \---Z.SiteCron
    | SiteCron.config
    | SiteCronJobs.config
    | 
    +---sitecore
    | \---admin
    | SiteCron.aspx
    | 
    \---SitecorePackage
     Konabos.Minions.RunMinion.dll
     Konabos.Minions.RunMinion.Help.txt
     SiteCron FULL Sitecore Package.zip
     SiteCron Items Only Sitecore Package.zip

    You should see there are two packages installed from NuGet along with some config, dlls and an admin page.

  3. Next I’d recommend installing the ‘SiteCron Items Only Sitecore Package.zip’ on your local Sitecore instance. This will install just Sitecore items that are required to run the module but no other files.install-sitecron-items-only-package
    Once you’ve installed the package you should see something like the following:
    sitecron-after-install
  4. Next, if your using Unicorn you should configure settings similar to below to ensure the items you just installed get Serialized to disk and deployed to other environments. Were using Helix Base but if you are not the config will be quite similar to the below.

    After completing step 7 below you should serialize this config from the Unicorn control panel once it’s deployed locally.
  5. Review the settings in /Z.SiteCron/SiteCron.config and adjust as required.

  6. Tidy up – you can now remove the Sitecore zip packages from the project and if you are not using Commerce you can remove the Minion dlls too.
  7. Build and publish the Project.
  8. Finally enable one of the sample Jobs that are installed in the OOTB folder and check that it runs correctly. If it does not run then Check the logs.

Creating Custom Jobs using SiteCron

Akshay has written some info on creating Jobs and using it like this one here. I’ve written a few posts before on this too so check them out.

Contributing to SiteCron

If you’d like to contribute to the module then I’m sure Akshay would appreciate it. You can pull the source from here: https://github.com/akshaysura/Sitecron and branch it and then create a pull request.

Note that the active branch is master and that the current code-base has been updated for 10.1. Therefore if you are looking to update the code for an older version of Sitecore then you may need to branch from an older commit to master instead. It’s probably best to reach out to Akshay to be sure.

Once you’ve created an updated version of the Module make sure you also update the AsemblyInfo.cs file with the new version number. You can then run the following command to create a NuGet package and share it with Akshay too:

nuget pack Sitecron.csproj -version 3.7.0

 

Hopefully this is useful for anyone working with SiteCron in future and I’ll aim to update this for future releases if required.

Published by

Adam Seabridge

I am a Freelance Sitecore Developer and 7x Sitecore Technology MVP (2024 - 2018). I have been working with Sitecore since 2013. You can reach me on twitter @billyjava or comment below if you have any questions or feedback.

One thought on “Installing SiteCron through NuGet and Configuring”

Leave a Reply

Your email address will not be published. Required fields are marked *