1

I have this XML file:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
        <assemblyIdentity name="Assembly1" version="1.1.0.0" type="win32" publicKeyToken="7XXXXXXXXXXXD"/>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
        <assemblyIdentity name="Assembly2" version="1.1.0.0" type="win32" publicKeyToken="7xxxxxxE89CD" />
    </dependentAssembly>
  </dependency>
</assembly>

I want to use Wix XmlConfig to remove the AssemblyIdentity element with name="Assembly2". I have tried this Wix configuration, but it is only working if the element I want to remove is the first element:

<util:XmlConfig On="install"
                Action="delete"
                Id="DeleteElement"
                Node="element"
                File="[MANIFESTFOLDER]\test.exe.Manifest"
                VerifyPath="//assembly/dependency/dependentAssembly/assemblyIdentity[\[]@name='Assembly2'[\]]"
                ElementPath="//assembly/dependency/dependentAssembly"
                Sequence="1">
</util:XmlConfig>

How can I remove my desired element even though it is not the top one?
(It doesn't necessarily have to be the last one, it can for example be the second last one.)

aengas
  • 155
  • 12
  • possible duplicate of [Deleting XML elements in WiX](http://stackoverflow.com/questions/2068743/deleting-xml-elements-in-wix) – Vladimir Dec 15 '12 at 11:31
  • By the way you don't need a fully qualified XPath in VerifyPath. If you look at the XmlConfig.cpp source it makes a query for the ElementPath first, then the VerifyPath from there, so it can be relative, simplifying your WIX code. – Tony Wall Feb 27 '13 at 14:12
  • I believe that this question can be answered by the two following posts:
    http://stackoverflow.com/q/2068743/1203288
    http://stackoverflow.com/q/13886728/1203288
    – bsara Dec 19 '12 at 20:32

0 Answers0