简体   繁体   中英

Add creation of shortcut menus option to the default WixUI_Mondo template

I have the following (default) markup for my WiX installer project:

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

It compiles into the following MSI:

在此处输入图片说明

I'm wondering, can I add "Create desktop shortcuts" option to that installation tree so that users could select or remove it?

You just need to move the Shortcut elements into their own component(s), and add those to a new Feature.

This guide does it that way: How To: Create a Shortcut on the Start Menu

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM