Octopus C# Step Templates

Nuget Packages

If you want to create larger step templates for Octopus it is advisable to use C# scripts which come from a nuget package.

  • nuget packages can store dependency DLLs as well as the actual script, allowing you to use third part DLLs and not just those stored in the GAC.
#r "Newtonsoft.Json.dll"
  • separate the script into a number of files, e.g.
#load "pool.csx"


Scripting in C# with Octopus does not work well namespaces or using statements so it’s advisable to qualify the types with their full name instead.

private System.Net.NetworkCredential _devAdminCredentials = new System.Net.NetworkCredential("admin", "Password123");

Octopus Parameters

Parameters for the step are created via the UI and can be referenced in C#.


It is a good idea to export the step template to JSON so that you have a backup of all the parameters which should be stored in source control.


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