wixwix3.6

How to fix ICE57.Per-User installation


Our application writes some settings to the registry into the HKCU hive during runtime. I want to delete this settings during uninstall. Here is code:

  <Fragment>
    <DirectoryRef Id="INSTALLLOCATION" DiskId="1" FileSource="$(var.SourceDirProject)\">
      <Component Id="DeleteHkcuManufacturerHive" Guid="GUID">
        <Condition>REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Condition>
        <CreateFolder/>
        <RemoveRegistryKey Action="removeOnUninstall"
 Id="HKCUkey" Root="HKCU" Key="Software\$(var.Manufacturer)"/>
      </Component>
    </DirectoryRef>
  </Fragment>

ICE57: Component 'DeleteHkcuManufacturerHive' has both per-user and per-machine data with a per-machine KeyPath.
Why I'm getting ICE57? Installation is per-User. Thank's in advance.

UPD: Where is here the per-machine element? May be it is an INSTALLLOCATION=Program Files\ManufacturerDirectory?


Solution

  • I've got an answer on wix-users mailing list. Here is Peter Shirtcliffe's answer:

    ProgramFiles is a per-machine location. You can only access it when elevated. If you want to install program code in a per-user installation, you should install to %LocalAppData%\Programs.

    Remove the condition entirely. The component will be installed but will have no effect until you uninstall the application. At that point, when the component is removed, the registrykey will be removed also.