我们的配置文件之一正在被奇怪地转换。
基本配置
<?xml version="1.0"?>
<configuration >
</configuration>
发布配置(因为它在项目中,为简洁起见被截断)
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore xdt:Transform="Insert">
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_web_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_web_index</param>
</index>
</indexes>
<indexes role:require="Standalone or ContentManagement">
<index id="sitecore_master_index">
<param desc="core" patch:instead="param[@desc='core']">#{IndexEnvironment}#_master_index</param>
</index>
运行构建后,最终配置的输出看起来很奇怪:
后期构建
<?xml version="1.0"?>
<configuration>
<sitecore>
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_web_index">
<param desc="core" d7p1:instead="param[@desc='core']" xmlns:d7p1="http://www.sitecore.net/xmlconfig/">ASHQA_web_index</param>
</index>
</indexes>
<indexes d5p1:require="Standalone or ContentManagement" xmlns:d5p1="http://www.sitecore.net/xmlconfig/role/">
<index id="sitecore_master_index">
<param desc="core" d7p1:instead="param[@desc='core']" xmlns:d7p1="http://www.sitecore.net/xmlconfig/">ASHQA_master_index</param>
</index>
注意patch和role定义如何分别更改为d7p1和d5p1。
虽然这是有效的 XML,但它会在我们的应用程序中引起问题,该应用程序解析 XML 并查找正确的patch和术语role。