Search code examples
nsis

NSIS MUI Icon in Programs and Features


I want to Show my custom icon in Windows Programs and Features. I have created a installer script through NSIS Below is my MUI userinterface settings

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON ".\Include\Images\Icons\icon.ico"
!define MUI_UNICON ".\Include\Images\Icons\icon.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\Include\Images\Header\header.bmp"
!define MUI_HEADERIMAGE_UNBITMAP ".\Include\Images\Header\header.bmp" 
!define MUI_HEADERIMAGE_RIGHT
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\Include\Images\Wizard\welcome.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\Include\Images\Wizard\welcome.bmp"

Solution

  • The icon must be registered as part of the uninstall values, you need to add a DisplayIcon string value that points to your .exe or .ico in $InstDir.

    Section
    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayIcon" "$InstDir\MyApp.exe"
    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayName" "My super app"
    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "UninstallString" '"$InstDir\UnInst.exe"'
    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "QuietUninstallString" '"$InstDir\UnInst.exe" /S'
    SectionEnd