Get Tentacle path for using Octopus.client.dll in C# Code


if I code a C# Script to use the Octopus.Client.dll from the Tentacle, how
can I get the installation path of Tentacle, I know that the r# directives must
the first code lines in the C# code, is it possible to get from the environment variables
the installation path and bind it as r# directives before I execute any C# Code…?

Hi @applepi,

Thanks for reaching out.

If you’re trying to use a C# Script within an Octopus Script step, you can do this by using the following at the top of your script:

#r "Octopus.Client\Octopus.Client.dll"

using Octopus.Client;
using Octopus.Client.Model;

On top of this, you also have to zip up Octopus.Client.dll and add it as a Referenced Package so that the tentacle has the file to work with.

Please let me know if that gets it working for you or if we need to look at it a bit more.


Thanks Jeremy, sounds good!

I prefer the solution:
#r “Octopus.Client\Octopus.Client.dll”

because if the Tentacle gets an update or a newer Version, the installation path can change or not, is the installation path for the Octopus.Client.dll always the same after update or newer Version installation?


Hi @applepi,

Octopus.Client actually will need to be put in a package and made to be a referenced package within the C# script step like in my screenshot above. The location of that file will always be the same as that’s where the Octopus.Client package will be unzipped to as a referenced package. To update Octopus.Client to a newer version, you will just need to zip up the new DLL file and use the latest package when creating a release.

Please let me know what you think.