.pubxml-使用发布定义变量更改变量 [英] .pubxml - Change variables with Release Definition variables

查看:95
本文介绍了.pubxml-使用发布定义变量更改变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行我的Powershell脚本,我传递了所有正常工作的所有参数,但我的setParameters.xml文件未更改Realese定义中的变量,而是保留了Release.pubxml文件中的值.如何修改.pubxml文件以具有可以使用Powershell脚本更改的变量/参数.

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.

推荐答案

将所有您不想替换的参数以这种格式 ParamToReplace 创建一个环境变量ParamToReplace

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

这篇关于.pubxml-使用发布定义变量更改变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆