Find current install directory previously deployed


I have a chicken and and egg which came first scenario.
Trying to work around it.

I have a project Proj-1 that has been already installed. Now I am creating a new project Proj-2 that I need to find the installation directory of Proj-1. This will be run independent from each other.

In an attempt to figure this out I created a new project with a single deploy script step which does this
$src = $octopusParameters[“Octopus.Action[#{step}].Output.Package.InstallationDirectoryPath”]
Write-Output “MY PATH: $src”
Where #{step} is defined as a project variable that is the actual step name of the IIS Deployment step in the first project Proj_1.

This results in nothing. How can I get the current installation directory for Proj_1?

(Kenneth Bates) #3

Hi Dave,

Thanks for getting in touch! Output variables are only available within the same deployment in which they are set, so unfortunately you can’t pass them to another project in this way. You could theoretically write this variable value to a file on disk, and then read that file during the deployment of the second project.

Another potential option is to take advantage of the Deploy a Release step (introduced in 2018.2.1) which would allow you to pass an output variable from a “child” project back into the “parent” project’s deployment. However this would couple them together which I gather you’re looking to avoid doing, but if you’re considering this route the syntax to retrieve this variable would look something like:

$OctopusParameters["Octopus.Action[Deploy Release Step Name].Output.Deployment[Child Step Name].Package.InstallationDirectoryPath"]

I hope one of these options helps! Don’t hesitate to reach out if you have any other questions or concerns. :slight_smile:

Best regards,



For my need I was working in IIS, so I ended up creating a PS script to find the current physical directory path. Posting in case anyone else needs it.

$iisWebsite = $iisWebsite.Trim()
if ($iisWebsite -notLike "*/") 
	$iisWebsite = $iisWebsite + "/"

$appCmd = "$Env:SystemRoot\system32\inetsrv\appcmd.exe"
$xml =  [xml](& $appCmd list app $iisWebsite /config /xml)

$path = "//appcmd/APP/application/virtualDirectory[@path='" +  $iisVirtualDirectory + "']"
$physicalPath = $xml.SelectNodes($path).physicalPath

Set-OctopusVariable -name "WebsiteDirectory" -value $physicalPath