带子文件夹的开始菜单

时间:2013-04-18 19:30:18

标签: wix wix3.5

我使用WiX并希望在用户的开始菜单中创建快捷方式,如

开始 - > [CompanyName] - > [ProgramName] - > APP.EXE

我可以这样做

开始 - > [ProgramName] - > APP.EXE

没有任何问题:

      <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>    

但是如果我再添加一个级别的文件夹,那么我会收到错误: 错误1 ICE64:目录ProgramMenuSubDir位于用户配置文件中,但未在RemoveFile表中列出。

据我所知,这意味着,我应该在系统卸载后完全清除(在这种情况下来自注册表)。怎么做?

2 个答案:

答案 0 :(得分:4)

对于用户个人资料中的每个文件夹,您都需要确保删除该文件夹。因此,您可以像这样调整示例:

<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>

确保所有每用户文件夹都具有每用户密钥路径(注册表项),并在卸载过程中正确标记为删除。

答案 1 :(得分:0)

这是我的代码。

<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>

快捷方式如下:

    <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>