gpt4 book ai didi

.net - 我可以使用Web Deploy将元素插入web.config吗?

转载 作者:行者123 更新时间:2023-12-03 15:24:32 25 4
gpt4 key购买 nike

是否可以使用Web Deploy的Parameters.xml system将XML元素插入到我的web.config中?

XmlFile 参数“kind”似乎与我需要的参数最接近,但其match属性仅接受XPath查询,而且我似乎无法在XPath查询中指定不存在的元素。 (或者,我可以指定一个不存在的元素-Web Deploy会忽略它。)具体来说,我想对此进行转换:

<configuration>
<plugins>
<add name="bleh"/>
</plugins>
</configuration>

到这个:
<configuration>
<plugins>
<add name="bleh">
<option name="foo" value="bar"/>
</add>
</plugins>
</configuration>

(不幸的是,我无法在web.config中预存一个空的 option元素,因为此特定的插件系统不喜欢无法识别的/空的选项。)

感谢您的任何想法!

最佳答案

从Web Deploy V3开始,这样的事情现在成为可能。
参见official documentation

Here is one example of a parameters.xml file which will add newNode to all nodes including the root in target xml file:


<parameters>
<parameter name="Additive" description="Add a node" defaultValue="&lt;newNode />" tags="">
<parameterEntry kind="XmlFile" scope=".*" match="//*" />
</parameter>
</parameters>

关于.net - 我可以使用Web Deploy将元素插入web.config吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5719745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com