简体   繁体   中英

How to optionally create shortcut in Microsoft Visual Studio Installer

I am now using Visual Studio 2019 and followed a guide on creating a installer project with the Microsoft Extension for creating installer projects. I've created the main project output, and also shortcuts to the Start menu and Desktop. However, I've got a request to make the shortcut to Desktop optional, but I don't see where to do this anywhere.

Anyone else tackled this problem?

For optional things in Wix Toolset use Feature element from the advanced installer UI.

WXS-Block for Feature

<Feature Id="StartMenuShortcut" 
             Title="My StartMenuShortcut" Description="Foo Bar ... Shortcut"
             Level="1" AllowAdvertise="no" Display="expand" InstallDefault="local" TypicalDefault="install">
  <ComponentRef Id="ShortcutsStartmenuStartProduct" />
</Feature>

WXS-Block for the Shortcut

<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Guid="nguid" Id="ApplicationShortcut">
    <Shortcut Id="OptionalShortcut"
                  Name="FooBar"
                  Target="BarFoo"/>
  </Component>
</DirectoryRef>

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