Jam*_*mes 5 .net cruisecontrol.net nant configuration
我正在尝试使用Cruise Control 预处理器功能将我的配置分成较小的可重用部分。我可以在根巡航控制节点内使用很棒的包含功能,如下所示:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:include href="child.config" />
</cruisecontrol>
Run Code Online (Sandbox Code Playgroud)
如果我尝试在子配置中使用另一个包含项(如下所示):
<project name="TestProject" xmlns:cb="urn:ccnet.config.builder">
<cb:include href="grandchild.config" />
</project>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:检测到未使用的节点:xmlns:cb =“ urn:ccnet.config.builder”
如果删除xmlns名称空间语句,则会收到此错误:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException:配置文件包含无效的xml:E:\ Build \ Config \ AppRiver.Tools.BuildAutomation \ CruiseControl \ ccnet.config ---> System.Xml.XmlException:'cb'是一个未声明的名称空间。
最后,如果我删除标签上的“ cb”前缀,则会收到此错误
Unused node detected: Unused node detected: <define buildFile="CP.WEB.Dev.SanityCheck.CI.build" />
Run Code Online (Sandbox Code Playgroud)
我没主意-任何帮助表示赞赏!
要使用<cb:include>的<cb:include>标签必须有定义的XML命名空间和包含的文件必须在它定义的XML命名空间的元素开始。这在文档中,但很容易遗漏。
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:include href="projectFile.xml" xmlns:cb="urn:ccnet.config.builder"/>
</cruisecontrol>
Run Code Online (Sandbox Code Playgroud)
projectFile.xml
<cb:config-template xmlns:cb="urn:ccnet.config.builder">
<project>
...
</project>
</cb:config-template>
Run Code Online (Sandbox Code Playgroud)
此外,如果您正在为加入指出CCNET版本信息在这里,您需要包括命名空间中所包含的文件中。
因此,ccnet.config看起来像:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/8">
<cb:include href="projectFile.xml" xmlns:cb="urn:ccnet.config.builder"/>
</cruisecontrol>
Run Code Online (Sandbox Code Playgroud)
和projectFile.xml更改为
<cb:config-template xmlns:cb="urn:ccnet.config.builder" xmlns="http://thoughtworks.org/ccnet/1/8">
<project>
...
</project>
</cb:config-template>
Run Code Online (Sandbox Code Playgroud)