WiX: Removing Files with Patches


This post has moved here.

Comments (6)

  1. Bowyer says:

    Hi, Peter:

    Thank you firstly!

    and I test as you said, but some exception.

    first, in the baseline wxs file:

    <Fragment>

           <DirectoryRef Id="SampleProductFolder">

               <Component Id="SampleComponent" Guid="C28843DA-EF08-41CC-BA75-D2B99D8A1983" DiskId="1">

                   <File Id="SampleFile" Name="Sample.txt" Source=".$(var.Version)Sample.txt" />

                   <File Id="classFile"  Name="loadtest.class" Source=".$(var.Version)loadtest.class" />

                   <File Id="SampleFileDel1" Name="SampleDel1.txt" KeyPath="no" Source=".$(var.Version)SampleDel1.txt" />

               </Component>

           </DirectoryRef>

       </Fragment>

    Now, I want remove the SampleDel1.txt, the wxs is changed into:

    <Fragment>

           <DirectoryRef Id="SampleProductFolder">

               <Component Id="SampleComponent" Guid="C28843DA-EF08-41CC-BA75-D2B99D8A1983" DiskId="1">

                   <File Id="SampleFile" Name="Sample.txt" Source=".$(var.Version)Sample.txt" />

                   <File Id="classFile"  Name="loadtest.class" Source=".$(var.Version)loadtest.class" />

                   <RemoveFile Id="delSampleFileDel1" Name="SampleDel1.txt" On="install" />  

               </Component>

           </DirectoryRef>

       </Fragment>

    Then, candle, light, torch, pyro.

    At last I get a warning:

    C:DevelopToolsWIXWIX3.0examplespatchexampleproduct10.wxs(29) : warning PYR

    O1095 : File ‘SampleFileDel1’ was removed from component ‘SampleComponent’. Remo

    ving a file from a component will not result in the file being removed by a patc

    h. You should author a RemoveFile element in your component to remove the file f

    rom the installation if you want the file to be removed.

    C:DevelopToolsWIXWIX3.0examplespatchexamplepatch.wxs(12) : warning PYRO107

    9 : The cabinet ‘RTM.cab’ does not contain any files.  If this installation cont

    ains no files, this warning can likely be safely ignored.  Otherwise, please add

    files to the cabinet or remove it.

    May I get your help to find out the reason?

  2. Petermarcu says:

    It looks like you are fine on both warnings. You did add a RemoveFile entry in the component and you are not expecting to have any files in the patch so both warnings are ok.

    For the first one, that is a bug. It should detect that you did add a RemoveFile entry and not show the warning.

  3. Bowyer says:

    Yes, Peter, you are right. There are just warnings, the patch works normally. Thank you very much!

    But when there is only one file (KeyPath file) in the component, it can’t work. I am still fighting for this problem. Heh, Heh.

    It’s dangerous and difficult!

    Maybe I will back to disturb you! Thank you again!

  4. Petermarcu says:

    Hmm, you may need to also add a seperate component which contains the RemoveFile entry rather than putting it in the same component in this case.

  5. Sivanathan says:

    Very Useful