【问题标题】:Web.config transformation using xpath fails for spring resource uri使用 xpath 的 Web.config 转换对于 spring 资源 uri 失败
【发布时间】:2012-12-13 22:45:55
【问题描述】:

我的 vs2010 web.config 文件中有以下部分。我需要在调试环境中的每个资源 uri 中将 /bin/ 替换为 /bin/config/ 。我尝试在 web.debug.config 中使用 xdt:transformation 和定位器,并且 web.release.config 中不需要任何转换更改,可以保持不变。

    <context>
        <resource uri="~/bin/file1.config.xml" />
        <resource uri="~/bin/file2.config.xml" />
        <resource uri="~/bin/file3.config.xml" />
    </context>

我尝试了几种不同的方法,但在 web.debug.config 中没有任何效果。这是我所拥有的不起作用。请帮忙。

        <resource uri="~/bin/Config/file1.config.xml" xdt:Transform="Replace" xdt:Locator="Condition(//resource[@uri='~/bin/file1.config.xml']) "/>
        <resource uri="~/bin/Config/file2.config.xml" xdt:Transform="Replace" xdt:Locator="Condition(//resource[@uri='~/bin/file2.config.xml']) "/>
        <resource uri="~/bin/Config/file3.config.xml" xdt:Transform="Replace" xdt:Locator="Condition(//resource[@uri='~/bin/file3.config.xml']) "/>

更新:我需要能够通过 Visual Studio IDE 调试我的网站来执行此操作。

【问题讨论】:

    标签: xpath web-config transformation xdt-transform


    【解决方案1】:

    1) 首先能够在 Visual Studio 中运行转换,在 Debug、Release 配置文件之间切换,发现这个 StackOverflow 线程 VS 2010 Web.config transformations for debugging

    http://ledtalks.posterous.com/webconfig-transformations-when-debugging#!/

    2) 实际转换对我有用,将 "xdt:Locator="Condition(..." 更改为 "xdt:Locator="XPath(... "

    【讨论】:

      猜你喜欢
      • 2018-02-28
      • 2012-03-24
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-30
      相关资源
      最近更新 更多