0

I'm using Wix Toolset to create a Windows installer. When I create a shortcut to the main executable and give the shortcut the exact same name as the executable (e.g., both are named MyApp.exe), the icon for the shortcut appears broken or missing after installation.

If I change the shortcut name to something else (e.g., MyApp My_App.lnk), the icon shows up correctly.

Here's a snippet from my Wix XML:

<Fragment>
    <Icon Id="LogoitHelper.ico" SourceFile="LogoSomeHelper.ico" />
        
    <Component Guid="73503335-40bb-428d-a3bb-b55efdac6359" Id="Somehelper_exe" Directory="INSTALLFOLDER">
        <File Source="..\App_Executables\Somehelper.exe" Checksum="yes" KeyPath="yes" Vital="yes" Name="Somehelper.exe"/>
    </Component>


    <Component Id="C_Registry_HKCU" Guid="80a60e11-05ab-4db3-945a-4047f45501bb">
        <RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" />
        <RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="path" Type="string" Value="[INSTALLFOLDER]" />
        
        <util:RemoveFolderEx Id="DesktopFolderRemove_HKCU" Property="SOMEHELPERFOLDER_HKCU" On="uninstall" Condition="(NOT UPGRADINGPRODUCTCODE) AND (FULLDELETE = &quot;true&quot;)"/>
        <util:RemoveFolderEx Id="DesktopFolderRemoveOnRepair" Property="SOMEHELPERFOLDER_HKCU" On="install" Condition="UREINSTALLING = &quot;true&quot;"/>
    </Component>



    <StandardDirectory Id="DesktopFolder">
        <Component Id="ApplicationShortcutDesktop_HKCU" Guid="d5e2c63a-28e7-4f92-826c-60b846192286" Condition="CREATEDESKTOP = &quot;true&quot;">
            <Shortcut Id="some_Helper_desktop_shortcut_HKCU"
                      Name="Somehelper"
                      Icon="LogosomeHelper.ico"
                      Directory="DesktopFolder"
                      Target="[INSTALLFOLDER]Somehelper.exe"
                      WorkingDirectory="INSTALLFOLDER" />


            <RemoveFolder Id="DesktopFolderRemove_HKCU" Directory="DesktopFolder" On="uninstall"/>

            <RegistryValue
                Root="HKCU"
                Key="Software\$(var.ProductName)"
                Name="shortcutdesktop_installed"
                Type="integer"
                Value="1"/>
        </Component>
    </StandardDirectory>
</Fragment>

Is this a known issue with Wix or Windows shortcut handling? How can I create a shortcut with the same name as the executable without breaking the icon?

1
  • Are you saying you want to create a Shortcut with the Name attribute set to Somehelper.exe? If so, that's weird. Maybe Windows is treating your installed shortcut as an executable, which it isn't. Commented May 1 at 17:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.