Today I came across an issue trying to use an XMLUpdate statement against the web.config in our team deployment build, and while the Googling did end up helping me resolve the issue, it didn't turn up any direct results that really showed/explained what I needed to do. So what would Brian Boitano do? Well, besides using his magical fire breath to save a maiden, he'd probably decide to dig up the rotting corpse of his blog and fill the void himself. So here we are!
Anyways, check out the relevant chunk of my config file (sensitive info obfuscated, of course):
<reference assemblyname="OurAssembly.Name" configrequired="True" />
<backendconfiguration id="mssqlConfiguration" backend="mssql">
As you can see, we're using the Telerik OpenAccess ORM tools. My goal was to insert some values into the connectionParams node specific to our deployed application scenario, so I originally had a statement in the team build proj file that looked like this:
Unfortunately, it didn’t work. After some digging I discovered that the xmlns attribute on the openaccess node messes with XPath, and that I could use a Namespace attribute to help solve that problem, but nothing really showed how exactly to do it. I used a little trial and error and came up with the solution as seen here:
So as a way of explanation, we define the namespace we're hunting for and assign it a prefix. Then, in the XPath, we use the prefix for any node that falls within that namespace, but not for the nodes before it takes effect (such as configuration).
All of this info is out there on the web in pieces, and I'm sure smarter folks than I can put it together quickly and move on, but hopefully this post will help the other goobers like me who would otherwise take an hour or two to put all the pieces of the puzzle together.