Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

here is my code.

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFiles64Folder">
      <Directory Id="company" Name="company">
        <Directory Id="INSTALLFOLDER" Name="prod" >
         <Directory Id="INCLUDEDIR" Name="include">
         <Directory Id="THIRDPARTYDIR" Name="3rdParty">
         <Directory Id="BIN" Name="bin"></Directory>

         </Directory>  
        </Directory>
       </Directory>
      </Directory>
    </Directory>


 <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ProgramMenuDir" Name="prod">
      <Component Id="ProgramMenuDir" Guid="0118D11A-0CA3-4E04-8D27-0B73A279A7FD">
        <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
        <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
      </Component>

    </Directory>
  </Directory>
 <Directory Id="DesktopFolder" Name="Desktop"/>
</Directory>
</Fragment>

the shortcuts will be like so:

    <DirectoryRef Id="INSTALLFOLDER">
    <Component Id="comp_bin_debug_30" Guid="EB4650EB-75DC-4562-9DC3-8FFDD9B55468">
    <File Id="file_bin_30" Source="..\bin\Debug.amd64\prod.exe" KeyPath="yes" DiskId="1" />
      <Shortcut Id="desktopProd" Directory="DesktopFolder" Name="prod"
      WorkingDirectory='INSTALLFOLDER' Icon="prod_GUI.ico" IconIndex="0" Advertise="yes" />
      <Shortcut Id="startmenuProd" Directory="ProgramMenuDir" Name="prod"
      WorkingDirectory='INSTALLFOLDER' Icon="prod_GUI.ico" IconIndex="0" Advertise="yes" />      
     </Component>
   </DirectoryRef>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top