Mikhail Churbanov
Mikhail Churbanov

Reputation: 4500

How to correctly add new files in WiX installation to create an uninstallable patch?

Good time,

I'm trying to create the uninstallable patch (msp file) which should contain the newly added files. The file is added in following maner:

<Directory Id="Some Dir">
  <Directory Id="MYDIR" Name="Some Name">
    <Component Id="Some Component" Guid="{GUID}" KeyPath="yes">
          <File Id="README.txt" Name="README.txt" Source="to_install\README.txt" KeyPath="no"/>
          <File Id="default.cfg" Name="default.cfg" Source="to_install\default.cfg" KeyPath="no"/>
          ... // some more files
    </Component>
  ...
...

I've also tried using the DirectoryRef but got the same results.

The "MYDIR" directory is used in other places also and several other files are already installed there, but the patch is adding new files, and the installation log shows that the CreateDirectory table becomes modified and the uninstallation for patch becomes disabled.

What is a correct way to do it using WiX?

Upvotes: 1

Views: 1178

Answers (2)

Mitul Rakholiya
Mitul Rakholiya

Reputation: 111

KeyPath : This value points to a file or folder belonging to the component that the installer uses to detect the component. It is creating entry in CreateFolder of MSI because of KeyPath is provide at component level that is taking installation folder as its key so your patch become not uninstallable.

Provide KeyPath at one of the file of component that is the most important for that component. So it does not make entry into CreatFolder table of MSI and your patch become uninstallable.

Upvotes: 3

PhilDW
PhilDW

Reputation: 20780

Whether a patch is uninstallable isn't really related to a piece of WiX source like that. One thing you definitely need for an uninstallable patch is a PatchMetadata table that says that the patch is uninstallable, as here:

http://wixtoolset.org/documentation/manual/v3/patching/patch_building.html

or here, see PatchMetadata table if you use a PCP file, AllowRemoval:

https://msdn.microsoft.com/en-us/library/aa370344(v=vs.85).aspx

So there are some things you need to do during patch creation to make the patch uninstallable that are nothing to do with your WiX source. It's not clear from your question how you are creating the patch correctly.

Even if you get the patch generation working, there are some rules that must be followed, described here:

https://msdn.microsoft.com/en-us/library/aa367850(v=vs.85).aspx

where it says (for example) that you can't change the component ids of any existing installed items. Create a verbose log when installing the patch and look for messages like SELMGR and entries saying removl of components is not supported, and if that has happened it means the patch will not apply correctly.

Upvotes: 2

Related Questions