Finding an assembly redirection in app.config
-
Hi guys! I'm looking for a way to find out if there's an assembly redirection for a given assembly in an app.config file. Let's say I have ClassLibrary1 version 1.2.0.0 and I want to find out if my app.config file already contains an assembly redirection for version 1.0.0.0 to 1.1.0.0. I'm afraid my XPath knowledge is not up to this task - I don't know how to combine conditions from different nodes. I have this XML snipplet: <dependentAssembly> <assemblyIdentity name="ClassLibrary1" publicKeyToken="..." culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" /> </dependentAssembly> and I want to get the dependentAssembly node with an assemblyIdentity child with @name='ClassLibrary' AND a bindingRedirect child with @oldVersion='1.0.0.0' Is this possible with XPath and if so, how? Thanks in advance
Regards, mav -- Black holes are the places where God divided by 0...
-
Hi guys! I'm looking for a way to find out if there's an assembly redirection for a given assembly in an app.config file. Let's say I have ClassLibrary1 version 1.2.0.0 and I want to find out if my app.config file already contains an assembly redirection for version 1.0.0.0 to 1.1.0.0. I'm afraid my XPath knowledge is not up to this task - I don't know how to combine conditions from different nodes. I have this XML snipplet: <dependentAssembly> <assemblyIdentity name="ClassLibrary1" publicKeyToken="..." culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" /> </dependentAssembly> and I want to get the dependentAssembly node with an assemblyIdentity child with @name='ClassLibrary' AND a bindingRedirect child with @oldVersion='1.0.0.0' Is this possible with XPath and if so, how? Thanks in advance
Regards, mav -- Black holes are the places where God divided by 0...
Looks as if I was just missing a small step - I think I can answer my own question :) For those interested: An XPath finding only the nodes I wanted is
//assemblyIdentity[@name="ClassLibrary1"]/../bindingRedirect[@oldVersion="1.0.0.0"]/..
Nevertheless - if someone else knows a better way I'm always willing to learn.Regards, mav -- Black holes are the places where God divided by 0...