Near impossible to create release via .Net client

I’ve been attempting all day to create a function to create a release and deploy it.

However the Octopus client has almost no documentation and is little more than a cover over all of the methods. I feel that in terms of actual business logic it doesn’t provide anything over the REST API.

The alternative is the Octo executable. This is cannot be used in a programmatic way except by executing it. I want to be able to iterate over multiple projects and deploy them with certain conditions.

How come you can’t expose the methods which the Octo.exe lets you perform in a NuGet package.

I’ve got this far - total prototyping code, but hit one more exception due to using a variable for the package ID, and I’ve had enough.

var project = this.octopus.Projects.FindByName(manifestProject.Name);

if (string.IsNullOrEmpty(project.VersioningStrategy.DonorPackageStepId))

var channel = this.octopus.Channels.FindByName(project, channelName);

var process = this.octopus.DeploymentProcesses.Get(project.DeploymentProcessId);

var release = new ReleaseResource
    ProjectId = project.Id,
    ChannelId = channel.Id,
    SelectedPackages = new List<SelectedPackage>()

foreach (var step in process.Steps)
    var packageStep = step.Actions.SingleOrDefault(x => x.ActionType == "Octopus.TentaclePackage");

    if (packageStep == null)

    var rule = channel.Rules.SingleOrDefault(x => x.Actions.Contains(step.Name));

    var packageId = packageStep.Properties["Octopus.Action.Package.PackageId"].Value;

    var packages = this.octopus.BuiltInPackageRepository.ListPackages(packageId, 0, int.MaxValue);

    var package = rule != null ? packages.Items.First(x => Regex.IsMatch(x.Version.Split(new[] { '-' }, 1).Last(), rule.Tag)) : packages.Items.First();

    release.SelectedPackages.Add(new SelectedPackage(step.Name, package.Version));

    if (step.Actions.Any(a => a.Id == project.VersioningStrategy.DonorPackageStepId))
        release.Version = package.Version;

This would greatly simplify the process.


Hi there,

Thanks for reaching out! I’m sorry to hear this task took so much of your time. I’ve written a quick example that should hopefully help you get started:

Let me know if that helps,

It’s a start but you end up in the same traps I did yesterday.

The Octo tool handles this perfectly, but it means kicking off processes… Why not encapsulate the business logic into a project which you can provide as a NuGet. That project can be wrapped with a console application so that you continue to provide Octo.exe.

Hi Matthew,

I brought your query to the team, and It turns out that we have plans to move most of the Octo.exe logic into the Octopus.client, but we just haven’t had the time just yet.

For the time being, you should be able to copy the code from here:


Hey Dalmiro. Thanks for speaking with the team. By any chance is that discussion on GitHub as I’d like to follow it.

My solution for now to wrap the Octo executable. I think this is the most appropriate approach as I cannot expect to cover the edge cases, also I’d like any future enhancements without having to do any extra leg work.

Thanks for your help, and I look forward to this becoming encapsulated in a package!

Hi Matthew - There isn’t a discussion on github yet, but we’ll create a github issue once we decide to start with the task.

Best regards,