I have following config for my mail:
我有以下配置我的邮件:
<system.net>
<mailSettings>
<smtp from="foo@bar.com" deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:/test"/>
<network host="localhost" userName="" password=""/>
</smtp>
</mailSettings>
</system.net>
This is my .Release version:
这是我的.Release版本:
<system.net>
<mailSettings>
<smtp from="foo@bar.com" xdt:Transform="RemoveAttributes(deliveryMethod)">
<network xdt:Transform="Replace" host="192.168.1.9" userName="" password="" />
</smtp>
</mailSettings>
</system.net>
How do I remove
我该如何删除
<specifiedPickupDirectory pickupDirectoryLocation="C:/test"/>
so it doesn't show in my .Release at all?
所以它根本没有显示在我的.Release中?
Also, I would like to remove other namespaces like System.Diagnostics
completely. What is the syntax for doing so?
此外,我想完全删除其他名称空间,如System.Diagnostics。这样做的语法是什么?
4 个解决方案
#1
24
For specifiedPickupDirectory
element this should work:
对于specifiedPickupDirectory元素,这应该工作:
<specifiedPickupDirectory xdt:Transform="RemoveAll" />
.
For System.Diagnostics:
对于System.Diagnostics:
<system.diagnostics xdt:Transform="RemoveAll"></system.diagnostics>
#2
16
<system.net>
<mailSettings>
<smtp from="foo@bar.com" xdt:Transform="Replace">
<network xdt:Transform="Replace" host="192.168.1.9" userName="" password="" />
</smtp>
</mailSettings>
</system.net>
This will replace that entire tag with yours.. hope this is what you are looking for..
这将用你的整个标签取代..希望这是你正在寻找的..
the good thing about this is that you dnt end up polluting your transform config with unnecessary remove commands like some of the answers stated here..
关于这一点的好处是你最终会用不必要的删除命令来污染你的转换配置,比如这里所说的一些答案。
consider the case where you have more than one child tags..
考虑你有多个子标签的情况..
#3
1
Rather than attempting to remove the config from your release version, can you take it from the base version and just add it to the .Debug version? That might be simpler. However if you want to remove it I think you can use <specifiedPickupDirectory xdt:Transform="Remove"/>
or something similar.
您可以从基本版本中获取配置而不是尝试从发行版本中删除配置,而只是将其添加到.Debug版本中吗?这可能更简单。但是,如果你想删除它,我认为你可以使用
#4
-4
@katit , you should maintain two different configs for dev and release.
@katit,你应该为dev和release维护两个不同的配置。
your webconfig should be dynamic and take the configs as below
你的webconfig应该是动态的,并采取如下配置
/qa/yoursettings.config
/release/yoursettings.config
one more sample
还有一个样本
<connectionStrings configSource="config\qa\connectionStrings.config"/>
when you go to qa or release , switch your web.config accordingly.
当你去qa或发布时,相应地切换你的web.config。
in this way it will be lot cleaner.
这样会更清洁。
#1
24
For specifiedPickupDirectory
element this should work:
对于specifiedPickupDirectory元素,这应该工作:
<specifiedPickupDirectory xdt:Transform="RemoveAll" />
.
For System.Diagnostics:
对于System.Diagnostics:
<system.diagnostics xdt:Transform="RemoveAll"></system.diagnostics>
#2
16
<system.net>
<mailSettings>
<smtp from="foo@bar.com" xdt:Transform="Replace">
<network xdt:Transform="Replace" host="192.168.1.9" userName="" password="" />
</smtp>
</mailSettings>
</system.net>
This will replace that entire tag with yours.. hope this is what you are looking for..
这将用你的整个标签取代..希望这是你正在寻找的..
the good thing about this is that you dnt end up polluting your transform config with unnecessary remove commands like some of the answers stated here..
关于这一点的好处是你最终会用不必要的删除命令来污染你的转换配置,比如这里所说的一些答案。
consider the case where you have more than one child tags..
考虑你有多个子标签的情况..
#3
1
Rather than attempting to remove the config from your release version, can you take it from the base version and just add it to the .Debug version? That might be simpler. However if you want to remove it I think you can use <specifiedPickupDirectory xdt:Transform="Remove"/>
or something similar.
您可以从基本版本中获取配置而不是尝试从发行版本中删除配置,而只是将其添加到.Debug版本中吗?这可能更简单。但是,如果你想删除它,我认为你可以使用
#4
-4
@katit , you should maintain two different configs for dev and release.
@katit,你应该为dev和release维护两个不同的配置。
your webconfig should be dynamic and take the configs as below
你的webconfig应该是动态的,并采取如下配置
/qa/yoursettings.config
/release/yoursettings.config
one more sample
还有一个样本
<connectionStrings configSource="config\qa\connectionStrings.config"/>
when you go to qa or release , switch your web.config accordingly.
当你去qa或发布时,相应地切换你的web.config。
in this way it will be lot cleaner.
这样会更清洁。