3

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

开始 -> [公司名称] -> [程序名称] -> App.exe

我可以这样做

开始 -> [程序名称] -> 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 表中。

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

4

2 回答 2

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>

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

于 2013-04-18T21:42:24.943 回答
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>
于 2013-04-18T20:32:30.137 回答