This guide will walk you through building an example job from scratch. It will teach you how to:

  1. Build the Host Application (this page)
  2. Build the job
  3. Run and Debug your job locally

Build the Host Application

Runly jobs are hosted in a console application that builds and runs Runly.JobHost in its Main method. There are several benefits to executing jobs this way:

  • Run from the command line or IDE without any special considerations
  • Debug using the same tools as any other console application
  • Manage dependencies in the project

Using the Runly App Template

  1. Install the Runly.Templates package.

    dotnet new -i Runly.Templates
  2. Create a directory for the project then use the runly-app template to create a new project:

    mkdir myproject
    cd myproject
    dotnet new runly-app

This will create a console application using the JobHost to bootstrap the application.

Using a Console App

If you’d rather not install/use the Runly app template, you can create jobs using a generic console app.

  1. Create a new .Net Core console app:

    mkdir myproject
    cd myproject
    dotnet new console
  2. Install the Runly nuget package in your project.

    dotnet add package Runly
  3. In Program.cs, replace the Main method with the following:

    static Task Main(string[] args)
    	return JobHost.CreateDefaultBuilder(args)
  4. Add a reference to the Runly namespace so JobHost resolves:

    using Runly;
  5. Be sure to set the csproj to pack as a tool so that Runly can run your app when you upload it:


Run the Application

You can run the application now using your IDE or via the command line:

dotnet run -- help

This will show you available commands that the Runly JobHost gives you for free.

Congratulations! You have now built the host application that will run your jobs.

Continue to Step 2: Build the Job >>