Update documentation for ScriptCS parameters

I was fiddling today with a C# script step template and had a hard time fetching the parameter values.

When running the script locally, I could access the parameters using Env.ScriptArgs, as per the documentation for ScriptCS which is also referred to from the Octopus custom scripts documentation.

However, this repeatedly gives an ArgurmentOutOfRange exception. Googling a bit lead me to Paul’s Gists on invoking ScriptCS scripts from which I figured out one can use named parameters using Octopus.Paramters[“parameterName”].

Can you update the documentation on this?

Hi Marcel,

Our docs already has an example under the Variables that shows to use Octopus.Parameters["parameterName"] syntax when running a ScriptCS script.

The sample that uses Env.ScriptArgs is located under the Passing parameters to scripts section which has an info box under with specifying You can use script parameters for file-based scripts that are sourced from a package.

I hope that helps.

Thank you and best regards,
Henrik

Thanks for your reply! Ah, apparently there are multiple scripts forms, I was pointed to the section starting here https://octopus.com/docs/deploying-applications/custom-scripts#Customscripts-PassingparameterstoC#scripts

For other readers, it might be welcome to clarify the section a bit and explain what’s the difference between the one and the other.

Hi Marcel,

Noted, and I’ll add a task for me to update the docs to make it clearer!

Thank you and best regards,
Henrik

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.