Variable replacement not working

I’ve got a project set up that has an appSettings key which is a direct file path to a file within the project. I added a variable to the project with the value “#{Octopus.Action[Deploy Nuget].Output.Package.InstallationDirectoryPath}\path\to\file.txt” but Octopus refuses to replace the variable, it just outputs the variable name text. Is this not possible?

Hi,

You’ll need to use:

#{Octopus.Action.Package.CustomInstallationDirectory}\path\to\file.txt

The reason is that the .Output. variables aren’t available until the step has finished executing.

Hope this helps,

Paul

Sorry for the delay, I’m just now getting to sink my teeth into this again.

I’m assuming you’re saying I need to specify the Custom Installation Directory for the package step and reference that variable? 'Cause the Custom Installation Directory variable doesn’t seem to output anything otherwise.

Thanks!

Hi,

We populate that field with where the files will be at the end of the deployment. If you do not have a custom install directory set, it will use the package expansion path, it’s kind of a short cut to know where the files will be while you are still within the package step. OctopusOriginalPackageDirectoryPath will also do the same thing.

Vanessa

Thanks Vanessa. I wasn’t able to get #{Octopus.Action[Deploy Nuget].Package.CustomInstallationDirectory} to work (possibly because I’m still on 2.5), but #{OctopusOriginalPackageDirectoryPath} worked like a charm.