Replacing single attribute in a web.config via a transformation

Feb 11, 2011 at 4:05 PM
there is an existing node in web.config, like:

<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

I need to change that via a web.config.transform to:

<issuerNameRegistry type="Microsoft.IdentityModel.Swt.SwtIssuerNameRegistry">

problem is that there's no other attribute that I can use to hint nuget to perform the match, and therefore I end up with two such elements in the config :(

Any ideas how to overcome it?

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471
Developer
Feb 11, 2011 at 5:53 PM

We don't have a good way to do anything like this right now. Best you could do is use powershell's xml magic to do that (powershell is pretty good at manipulting xml).

Feb 11, 2011 at 6:09 PM
yup, I'll have to do that, but it's tricky to get the "uninstall" script right for those cases. I have to keep the old value around or something, XML comments are not very easy to manipulate either IIRC..
Developer
Feb 11, 2011 at 6:25 PM

Yea, our xml transforms are pretty magical.

Feb 11, 2011 at 7:25 PM

The part about having to keep the old value around for uninstall would be an issue even if we used a fancier transorm engine that supported that. In the end, the old value needs to be stored somewhere.

Feb 11, 2011 at 7:37 PM
absolutely. fun scenario to work on :)

how about a modification to the current XDT that actually gives you back what it replaced as it run? Essentially it could generate a transform to undo the applied transform :o)