将创建快捷菜单选项添加到默认WixUI_Mondo模板

时间:2014-04-03 00:01:12

标签: windows wix windows-installer wix-gui

我的WiX安装程序项目有以下(默认)标记:

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id='ProgramFilesFolder' Name='PFiles'>
    <Directory Id='Acme' Name='Acme'>
      <Directory Id='INSTALLDIR' Name='Foobar 1.0'>

        <Component Id='MainExecutable' Guid='*'>
          <File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1'
                Source='FoobarAppl10.exe' KeyPath='yes'>
            <Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" 
                      Name="Foobar 1.0" WorkingDirectory='INSTALLDIR' 
                      Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
            <Shortcut Id="desktopFoobar10" Directory="DesktopFolder" 
                      Name="Foobar 1.0" WorkingDirectory='INSTALLDIR'
                      Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
          </File>
        </Component>

        <Component Id='HelperLibrary' Guid='*'>
          <File Id='HelperDLL' Name='Helper.dll' DiskId='1' 
                Source='Helper.dll' KeyPath='yes' />
        </Component>

        <Component Id='Manual' Guid='*'>
          <File Id='Manual' Name='Manual.pdf' DiskId='1' 
                Source='Manual.pdf' KeyPath='yes'>
            <Shortcut Id="startmenuManual" Directory="ProgramMenuDir" 
                      Name="Instruction Manual" Advertise="yes" />
          </File>
        </Component>

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

  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ProgramMenuDir" Name="Foobar 1.0">
      <Component Id="ProgramMenuDir" Guid="*">
        <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>

它编译成以下MSI:

enter image description here

我想知道,我可以在该安装树中添加“创建桌面快捷方式”选项,以便用户可以选择或删除它吗?

1 个答案:

答案 0 :(得分:3)

您只需将快捷方式元素移动到自己的组件中,然后将其添加到新功能中。

本指南就是这样做的:How To: Create a Shortcut on the Start Menu