【发布时间】:2018-09-03 09:20:37
【问题描述】:
我正在尝试对我的服务 app.config 中的子元素应用转换。 我有几个服务,我只需要替换一个属性。
示例服务条目
<configuration>
<cronService>
<cronSettings>
<services>
<service name="Name1" assembly="xxx.yyy.Applications.dll" interval="300" wakeUpTime="" onErrorEmail="developmentteam@zzz.com" continueAfterError="true" notifyEmailOnError="true" runOnStart="true" enable="true" />
<service name="Name2" assembly="xxx.lll.Applications.dll" interval="300" wakeUpTime="" onErrorEmail="developmentteam@zzz.com" continueAfterError="true" notifyEmailOnError="true" runOnStart="true" enable="true" />
</services>
</cronSettings>
</cronService>
</configuration>
在转换文件中,我尝试在父级应用 xdt:Transform 并期望子级得到更改
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<cronService>
<cronSettings emailSender="{AppTierCloudService}@zzz.com" xdt:Transform="SetAttributes" >
<services xdt:Transform="SetAttributes" >
<service onErrorEmail="developmentteam@www.com, abb@www.com"/>
</services>
</cronSettings>
</cronService>
</configuration>
推荐了这个https://msdn.microsoft.com/en-us/library/dd465326.aspx。
但是转变并没有发生。有什么帮助吗?
【问题讨论】:
-
是我更新了
-
如果通过webconfigtransformationtester.apphb.com 运行示例 XML 会发生什么?它对我有用,所以请解释它的作用以及你需要它做什么。
-
转换没有发生。基本上,我正在尝试将 onErrorEmail 属性值从“developmentteam@zzz.com”更改为“developmentteam@www.com,abb@www.com”。无论如何感谢那个网站,它节省了我很多时间。
-
在子作品中添加 xdt:Transform="SetAttributes"。
标签: c# asp.net .net asp.net-core console-application