.NET code example of how to upload Artifacts to a particular release?

Hi All.
I’ve been trying to play around with the Octopus.client API with a view to being able to upload release artifacts.
has anyone done this before and has some code they can share with me ?

I’m struggling with how to supply the correct IDs to the PutContent in order to target the desired release.

Here are my small beginnings:

var octopus = new OctopusRepository(new OctopusServerEndpoint(Properties.Settings.Default.OctopusEndPoint, Properties.Settings.Default.OctopusAPIKey));

        var project = octopus.Projects.FindByName("ProjectName");

        var releases = octopus.Releases.Get(project.Link("Releases"));

Help would be much appreciated.

Hi there,

Thanks for reaching out. Are you trying to upload an artifact before, during or after the release was deployed?

Need to understand a bit better what you want to do to see if its possible and to provide a snippet :slight_smile:



Thanks for the reply.

I’m trying to upload after a deployed release so I can add automated test result documents etc. Because tests get run after a deployment.

We like the idea of Octopus deploy being a central source of truth for release deployment info and artifacts.

Ideally, the script / code would take an Octopus release id (or derive latest project release id from project slug) and folder path filename (bytestream or whatever) and proceed to upload the artifact so that it is visible for a particular release.

Best regards.


Hi Richard,

This code snipped should do

Let me know how it goes


Many thanks Dalmiro. That code snippet was exactly what I was looking for.

I had to comment out the createdArtifact.Dump(); statement as my client ( did not seem to support it, Code seems to work OK without it. Thanks again.


Hi Richard,

Glad to hear!