Question

How to concatenate web config resources directory path with resolved main directory path. In Octopus resolve-path gets me correct path of directory but I wont be able to concatenate that path with another directory. I am using following code, please guide.

$webConfigResources = (resolve-path .)
$webConfigResources +=  "\ResourcesConfiguration.config"
$doc = (gc $webConfigResources) -as [xml]
$doc.SelectSingleNode('//resourcesConfigSection/resources/@baseDirectory').'#text' =            
$doc.Save($webConfigResources)
Was it helpful?

Solution

Resolve-Path returns a System.Management.Automation.PathInfo object (not a string). Use Join-Path:

$webConfigResources = Join-Path (Resolve-Path .) "\ResourcesConfiguration.config"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top