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)
Était-ce utile?

La solution

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

$webConfigResources = Join-Path (Resolve-Path .) "\ResourcesConfiguration.config"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top