【问题标题】:web.config transformation and the location elementweb.config 转换和位置元素
【发布时间】:2011-08-02 18:27:50
【问题描述】:

我似乎无法弄清楚您将如何更改以下内容

<configuration>
<location path="hello123">
<.../>
</location>
</configuration>

<configuration>
<location path="world321">
<.../>
</location>
</configuration>

不删除第一个并添加第二个。对此的任何帮助都会很棒。

谢谢

【问题讨论】:

  • 你用什么来做转换?它是某种类型的 XSLT 还是在代码中?
  • VS2010 已内置 - 请参阅 msdn.microsoft.com/en-us/library/dd465326.aspx
  • 我想避免删除然后添加的原因是因为允许/拒绝条件可能会在 location 元素中发生变化,我不想更改 web.config 和转换文件。希望这是有道理的。
  • 哦...不错!我没听说过,我得去读一读。谢谢!

标签: asp.net web-config web-config-transform


【解决方案1】:

你可以使用SetAttributes,像这样:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <location path="world321" xdt:Transform="SetAttributes(path)" >
  </location>
</configuration>

您可以在 AppHarbor web.config transformation tester 上测试此转换和其他转换。

【讨论】:

  • 您也可以右键单击 Web.Config.Release 并选择“预览转换”(在 VS2012 中肯定是在 VS2010 中)
猜你喜欢
  • 1970-01-01
  • 2011-07-07
  • 2011-05-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-15
  • 1970-01-01
  • 2014-09-18
相关资源
最近更新 更多