问题
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