How to fix ICE57.Per-User installation

2020-04-05 09:17发布

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?

标签: wix wix3.6
2条回答
The star\"
2楼-- · 2020-04-05 09:32

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.

查看更多
甜甜的少女心
3楼-- · 2020-04-05 09:49

You are operating on the HKCU hive which is only available to the current user.

MSDN states:

ICE57 validates that individual components do not mix per-machine and per-user data. This ICE custom action checks registry entries, files, directory key paths, and non-advertised shortcuts. Mixing per-user and per-machine data in the same component could result in only partial installation of the component for some users in a multi-user environment.

The ICEs are validations on your installation package. As stated above, ICE57 is to make sure you don't mix up per-machine and per-user constructs. If you must remove entries to HKCU during uninstall (and the software is installed per-machine) then you can turn off that specific validation in Visual Studio in Properties > Tool Settings as shown in the screenshot below:

enter image description here

However, you may want to think about the root cause of your issue. If you are doing a per-machine install, your installer or application should probably not be writing to HKCU as it is only available to the current user, whereas your app is installed for all users.

查看更多
登录 后发表回答