No variable substitution in Create Folder step parameter

I’m trying to add a step to create a folder using the community step template File System - Create Folder but no substitution is happening for the folder name parameter. I’ve set it up as
The folder path to create on the filesystem: “#{Octopus.Action.Package.InstallationDirectoryPath}\Contexts”

but this is copied verbatim, so the script fails with “Creating folder #{Octopus.Action.Package.InstallationDirectoryPath}\Contexts” with permissions.

Error
InvalidArgument: Illegal characters in path."

I’ve tried it as a child of the deployment to IIS step and as a separate Step 2, both with the same result.

How do I get it to create a sub-folder under the deployed folder?

Hi @philipg , thanks for reaching out.

The variable Octopus.Action.Package.InstallationDirectoryPath is not expanded because it is not available in the step, and any unmatched variable is reproduced verbatim.

The easiest way to list the available variables in a step is to set the OctopusPrintEvaluatedVariables Octopus variable to true. This variable is documented in more detail at https://octopus.com/docs/support/debug-problems-with-octopus-variables#DebugproblemswithOctopusvariables-Writethevariablestothedeploymentlog. The verbose logs then show all the variables that can be consumed by the step.

The screenshot below shows an example of the available variables.

Specifically the Octopus.Action.Package.InstallationDirectoryPath variable is not exposed by the Create Folder step, as it does not deploy a package. It sounds like you may be trying to get the value of this variable from a previous step, in which case the format of the variable is [Octopus.Action[Previous Step Name].Output.Octopus.Action.Package.InstallationDirectoryPath].

I hope this helps.

Regards
Matt C