Teamcity 使用powershell脚本替换app.config中的文本

Teamcity 使用powershell脚本替换app.config中的文本,teamcity,powershell-2.0,replace,Teamcity,Powershell 2.0,Replace,我正在尝试一个简单的替换脚本来替换app.cofig文件中的文本。但它只是处理,什么也不做: $old = 'Z:\gene' $new = 'z:\gene\scripts' Get-ChildItem z:\gene\scripts\Test\App.config -Recurse | Where {$_ -IS [IO.FileInfo]} | % { (Get-Content $_.FullName) -replace $old,$new | Set-Content $_.FullNam

我正在尝试一个简单的替换脚本来替换app.cofig文件中的文本。但它只是处理,什么也不做:

$old = 'Z:\gene'
$new = 'z:\gene\scripts'
Get-ChildItem z:\gene\scripts\Test\App.config -Recurse | Where {$_ -IS [IO.FileInfo]} |
% {
(Get-Content $_.FullName) -replace $old,$new | Set-Content $_.FullName
Write-Host "Processed: " + $_.FullName
}
知道我做错了什么吗。同样的脚本也适用于.txt文件
谢谢

App.config是xml格式的,但它也是一个文本文件,应该可以使用相同的格式。我的猜测是,你有一个不同的价值观,你的工作,他们没有击中。如果您将该文件重命名为app.txt,是否有效?如果你是从No.Script运行的,你也可以考虑使用NaveXMLPOKE。p> 是选中..更换时似乎没有编写路径驱动器的脚本。如果您使用简单文本而不是z:则它可以工作。任何关于如何替换完整路径的想法。