.pubxml - Change variables with Release Definition variables

拈花ヽ惹草 提交于 2019-12-25 16:57:32

问题


I am trying to run my powershell script i pass in all the arguments everything is working but my setParameters.xml file in not changing the Variables from the Realese definition instead it keeps the values from my Release.pubxml file. How could I modify my .pubxml file to have variable/parameters i could change using powershell script.


回答1:


Bring all parameters which you wont to replace in this form ParamToReplace Create a environment variable 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 $contents


来源:https://stackoverflow.com/questions/44241083/pubxml-change-variables-with-release-definition-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!