Update configSource of XML element in web.config using Powershell by passing in Parameters

前端 未结 2 1664
长情又很酷
长情又很酷 2021-01-07 04:26

I am trying to figure out a way to update my web.config for different environments by updating the configSource for the appSettings element in the web.config.

Here

2条回答
  •  旧巷少年郎
    2021-01-07 05:18

    Im looking for a way to modify the code as well.

    Here is a way you can view whats the node:

    $path = 'c:\site\web.config'
    $PublishState = (Select-Xml -Path $path -XPath "configuration/appSettings/add[@key='PublishState']/@value").Node.'#text'
    $PublishState
    

提交回复
热议问题