我试图用XmlMassUpdate基础上构建的版型来更新我的配置文件。 人们似乎对如何更新新的app.config(VS2008)没有文档设置格式的任何地方。
这是配置部分:
<applicationSettings>
<CTC.Mica.ClientService.Properties.Settings>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService"
serializeAs="String">
<value>URL</value>
</setting>
</CTC.Mica.ClientService.Properties.Settings>
</applicationSettings>
我试图更新此文件中的URL值:
<Debug>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>DEVURL</value>
</setting>
</Debug>
<Test>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>TESTURL</value>
</setting>
</Test>
<Release>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>LIVEURL</value>
</setting>
</Release>
运行脚本,我可以代替无论是“名”或“serializeAs”属性,但不是值节点。
我将如何去替换值节点?
问候
三
下面的脚本正常工作,我(对1.3.0.471运行,这可能是一个每晚构建):
build.proj
<Project DefaultTargets="Run" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.targets" />
<Target Name="Run">
<Delete Condition="Exists('output.xml')" Files="output.xml"/>
<XmlMassUpdate
ContentFile="input.xml"
ContentRoot="/test"
SubstitutionsFile="subs.xml"
SubstitutionsRoot="/substitutions/release"
MergedFile="output.xml"
/>
</Target>
</Project>
input.xml中
<test>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>URL</value>
</setting>
</test>
subs.xml
<substitutions xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate">
<release>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="Testing">
<value>LIVEURL</value>
</setting>
</release>
</substitutions>
的Output.xml(由构建生成)
<test>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="Testing">
<value>LIVEURL</value>
</setting>
</test>