我正在尝试运行我的powershell脚本,我传递了所有的参数,所有的参数都正常工作,但是我的setParameters.xml文件在不更改Realese定义中的变量的情况下,而是将Release.pubxml文件中的值保存下来。如何修改我的.pubxml文件,使其具有使用powershell脚本可以更改的变量/参数。
发布于 2017-05-29 11:12:13
将您在此表单中不愿替换的所有参数ParamToReplace创建一个环境变量ParamToReplace
# read the setParameters.xml file
$contents = Get-Content -Path $paramsFilePath
# Replease all environment variables with mathing token
Get-ChildItem -path env:* | % {$contents = $contents -replace ('__{0}__' -f $_.Name),$_.Value}
# save the new content of the setParameters.xml
Set-Content $paramsFilePath -Value $contentshttps://stackoverflow.com/questions/44241083
复制相似问题