Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start menu with subfolder

Tags:

wix

wix3.5

I use WiX and want to create shortcut in user's start menu like

Start -> [CompanyName] -> [ProgramName] -> App.exe

I can do like

Start -> [ProgramName] -> App.exe

without any problem:

      <Directory Id="ProgramMenuFolder">
    <Directory Id="ProgramMenuDir" Name="RoverSoft Test">
    </Directory>
  </Directory>      
</Directory>

<DirectoryRef Id="ProgramMenuDir">
  <Component Id="ProgramMenuDirComponent" Guid="{A9858D4C-085A-4132-AD2E-F90A1E5C64A6}">
    <RemoveFolder Id="ProgramMenuDir" On="uninstall" />
    <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
  </Component>
</DirectoryRef>    

But if I add one more level of folders then I get error: Error 1 ICE64: The directory ProgramMenuSubDir is in the user profile but is not listed in the RemoveFile table.

as I understand, it means, that I should fully clear after a system uninstall (from registry in this case). How to do it?

like image 588
Oleg Sh Avatar asked Sep 16 '26 01:09

Oleg Sh


1 Answers

For every folder in the user's profile, you'll want to ensure the folder is removed. So, you can adjust your example like so:

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id="ProgramMenuFolder">
    <Directory Id="ProgramMenuCompanyDir" Name="Company Name">
       <Directory Id="ProgramMenuProgramDir" Name="ProgramName"/>
    </Directory>
  </Directory>
</Directory>

<Component Id="ProgramMenuCompanyDirComponent" Directory='ProgramMenuCompanyDir'>
  <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name='InstallVersion'
                 Value="[ProductVersion]" Type="string" />
  <RemoveFolder Id="RemoveProgramMenuCompanyDir" On="uninstall" />
</Component>

<Component Id="ProgramMenuProgramDirComponent" Directory='ProgramMenuProgramDir'>
  <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name='InstallFolder'
                 Value='[INSTALLFOLDER]' Type="string" />
  <RemoveFolder Id="RemoveProgramMenuProgramDir" On="uninstall" />
</Component>

That ensures that all the per-user folders have per-user key paths (the registry keys) and are correctly marked to be removed during uninstall.

like image 68
Rob Mensching Avatar answered Sep 24 '26 23:09

Rob Mensching



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!