PDA

View Full Version : New XML elements include alias


TOWENS
09-12-2013, 07:51 PM
I'm trying to update an custom TrafficMandatoryFiles element in a TFS 2008 TFSBuild.proj file that's using a namespace as shown below.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<TrafficMandatoryFiles>newfile</TrafficMandatoryFiles>
</PropertyGroup>
</Project>

I defined an alias as "msbuild" and update the element using "msbuild:Project/msbuild:PropertyGroup/msbuild:TrafficMandatoryFiles" in the XPath which works fine.

My issue is that if the element doesn't exist and it has to add it, it's added with the alias as
<msbuild:TrafficMandatoryFiles xmlns:msbuild="http://schemas.microsoft.com/developer/msbuild/2003"></msbuild:TrafficMandatoryFiles>
which is technically accurate but confusing to novices (like me) to read.

I can clean it up with a Replace in File action but wondered if there's anything I can do in the XML action to prevent it?

While I'm asking, is there any way to keep the Write XML action from making style changes (indentation, white space, in-line comments). It makes a real mess out of multiline elements and comments that were added with leading spaces instead of tabs.

Thanks,
Tom

kinook
09-13-2013, 06:39 AM
That's not currently possible in the Write XML action, but we'll look into it, as well as supporting the preserveWhiteSpace property.

kinook
10-09-2013, 04:53 PM
These are now supported in v8.5.