Access extracted directory as a variable?


I have a “WebDirectory” property in my appSettings config, its supposed to map to c:\inetpub…\ (where web.config is located etc).

I can’t see a way to automatically update this property using Variable transforms/replacement in the Variables section of Octopus.

I see was mentioned as being a v1 feature; is this feature available?


Hi Andrew,

Currently this isn’t available, but you can get it from PowerShell via “Resolve-Path .”. For example, this script could be named Deploy.ps1:

$currentDirectory = (resolve-path .)
$configFile = (join-path $currentDirectory "web.config")

$doc = New-Object System.Xml.XmlDocument
$setting = $doc.SelectSingleNode("/configuration/appSettings/add[@key = 'WebDirectory']")
$setting.SetAttribute("value", $currentDirectory)

Hope that helps,


Those interested in this in C# can use System.IO.Directory.GetCurrentDirectory()


This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.