#1
|
|||
|
|||
New XML elements include alias
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 |
Tags |
xml alias |
|
|