对于 Spring 资源 uri,使用 xpath 的 Web.config 转换失败



我的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调试我的网站执行此操作。

1) 首先能够从 Visual Studio 内部运行转换 在调试、发布配置文件之间切换找到这个 堆栈溢出线程 VS 2010 用于调试的 Web.config 转换

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

2)实际转换对我有用,更改了"xdt:定位器="条件(..."使用 "xdt:Locator="XPath(..."

最新更新