I have an Internet Explorer Add-On that generates some files in LocalAppDataFolder\Microsoft\Windows\Temporary Internet Files\CompanyName\AddOnName\
I have a WIX installer for the application that I would like to have delete the CompanyName\AddOnName\ folders on both install and uninstall.
I have never used WIX before, and I’m more of a MacOS guy, so all of this stuff is a bit foreign to me. Here is a portion of what I have right now (in my Product.wxs file):
<Feature Id="ProductFeature" Title="Company IE Add-On" Level="1" ConfigurableDirectory="INSTALLFOLDER">
<ComponentRef Id="INSTALLFOLDER" />
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="dataDirectory"/>
</Feature>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company IE Add-On" >
<Component Id="INSTALLFOLDER" Guid="THERE IS A GUID HERE">
<RemoveFolder On="both" Id="INSTALLFOLDER"/>
<RegistryValue Root="HKLM" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="Company IE Add-On" />
</Component>
</Directory>
</Directory>
<Directory Id="LocalAppDataFolder">
<Directory Id="Microsoft">
<Directory Id="Windows">
<Directory Id="TempInetFiles" Name="Temporary Internet Files">
<Directory Id="CompanyName">
<Directory Id="AddOnName">
<Component Id="dataDirectory" Guid="E5938D44-5315-43D4-94EC-313F6CDB290B" NeverOverwrite="no" Permanent="no">
<RemoveFolder Id="AddOnName" On="both"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
But this is giving me errors like “Component dataDirectory installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.”
And “The directory CompanyName is in the user profile but is not listed in the RemoveFile table.”
Any help would be greatly appreciated.
Thanks.
WiX requires that you always use an HKCU registry entry whenever creating a user-specific component. In this case, dataDirectory will always be installed in the current user’s profile. Add an HKCU or HKMU registry element inside the component as in:
This will not have any visible effect in case of a per-machine installation as you already have HKLM\Software[Manufacturer][ProductName]. In case of a per-user installation, it will create HKCU\Software[Manufacturer][ProductName].
Replace the HKMU with HKCU if it still fails with the same error.
For the second problem, check out:
Directory xx is in the user profile but is not listed in the RemoveFile table.