While working on substitution files at work that hook into MSBuild and XmlMassUpdate, I noticed XML elements that are empty (<foo></foo>) compile into <foo>\r\n</foo>. No worries, XmlMassUpdate should be able to find this and inject the value I want.
- Wrong -
Most likely a bug in XMU or we’re running an out dated version was causing this. Still this was a problem since we had default elements that needed to be empty. This was a huge thorn in our side during test-deployments since XMU was refusing to inject values into elements that contained an empty new line.
So how did we get around it? Well it just so happens the ‘remove’ XMU action is able to find the element and remove it. Oddly not able to inject our substition though.. Our substitution file was then modified to look like this, which was successful:
|
1 2 3 4 |
<transformManagerWatchfolderUsername xmu:action="remove" /> <transformManagerWatchfolderPassword xmu:action="remove" /> <transformManagerWatchfolderUsername>some_user</transformManagerWatchfolderUsername> <transformManagerWatchfolderPassword>some_pass</transformManagerWatchfolderPassword> |
This was my solution and I hope it somehow helps you.