Custom directory powershell issue

Hi,

I have a step that is deploying a web application to a server, in a custom location.

I then have a step after this, that tries to get hold of the custominstallation directory and then read the web.config from it.

This step keeps failing, it doesn’t seem to get the custom directory:

Get-Content : Cannot find path ‘C:\web.config’ because it does not exist.

I was expecting $dir to be wwwroot\blah\blah

$dir = $OctopusParameters[‘Octopus.Action.Package.CustomInstallationDirectory’]

$config = Get-Content -path “$dir\web.config”

Any ideas?

Thanks,
James.

Hi James,

Thanks for getting in touch! Since you’re wanting to retrieve the custom installation directory in a separate step from the one that deploys the web application, you’d need to specify the step name in the variable using indexer notation. I suspect this will give you the directory value that your web app step sets: $dir = $OctopusParameters[‘Octopus.Action[WebAppStep].Package.CustomInstallationDirectory’]

Let me know how you go or if you have any further questions or concerns going forward!

Best regards,

Kenny

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