.netwix

Use application icon for shortcut icons in WIX installer


My C#.net application has a .ico file in the Resources directory (e.g. MyProject/Resources/icon.ico),

I have created an installer using the WIX toolset.

When I install the application the icon shows in the top left of the window, but not on the task bar (show in taskbar is set to true in the application) and not along side the .exe

How do I reference the application icon in the wix xml source so it shows on the .exe file in Program Files and on the start menu?


Solution

  • You need to specify the Icon tag within your app menu Shortcut tag. Here's an example of the Icon tag:

        <Icon Id="MyIconID.exe" SourceFile="..\PathToLogo\yourLogo.ico"></Icon>
    

    Here's where you should put it:

    <Shortcut Id="MyAppStartMenuShortcut" 
                  Name="MyApp" 
                  Description="My App description" 
                  Target="[INSTALLFOLDER]MyAppPathMyApp.exe" 
                  WorkingDirectory="MyApp">
                  <Icon Id="MyIconID.exe" SourceFile="..\PathToLogo\yourLogo.ico"></Icon>
        </Shortcut>
    

    The path in the SourceFile is the path to the icon you want to import. Wix will take care of adding the icon to your installation file and also makes sure it gets shown in your Program Files. Hope this helps!

    Edit: As user Beauty states, make sure that your Icon Id also ends with ".ico". I have updated my answer.