Skip to content

AppImage: --icon parameter ignored; generated .AppImage does not include specified icon #192

Description

@Ktn429

Steps to reproduce

  1. On Windows run the following command (exact command I used):
dotnetpackager appimage from-directory \
  --appId com.yang429.nuketest \
  --directory E:\Workspace\ICode\C#\nuke_test\artifacts\linux-x64 \
  --appName nuke_test_avalonia \
  --summary "hello appimage" \
  --output E:\Workspace\ICode\C#\nuke_test\artifacts\nuke_test_avalonia-linux-x64.appimage \
  --icon E:\Workspace\ICode\C#\nuke_test\nuke_test_avalonia\Assets\icon.png

(Please adjust paths for reproduction; the command above is exactly what I ran.)

Expected behavior

  • The resulting AppImage should include the specified icon files, for example:
    • usr/share/icons/hicolor/256x256/apps/{packagename}.png
    • usr/share/icons/hicolor/scalable/apps/{packagename}.svg (if an SVG is provided)
  • The .desktop file's Icon field should reference the package/icon name so desktop environments can display the application icon.

Actual behavior

  • Even though I specified --icon <path>, the produced .AppImage does not contain the icon (the expected png/svg paths are missing) and the desktop environment does not show the application icon.

Environment

  • Repository: SuperJMN/DotnetPackaging
  • I ran the tool on Windows using the command above.
  • The icon file is a PNG located at Assets/icon.png in my project.

Clues from the repository

  • The CLI documentation (WARP.md / AGENTS.md) and tool options list a --icon <path> option.
  • AppImageOptions.cs defines IconNameOverride, and unit tests set AppImageOptions.IconNameOverride to assert icon files are present in the build plan. That indicates AppImageFactory/BuildPlan will include icons if given the correct option.
  • However, in the CLI packaging flow (AppImagePackager.Pack -> ToAppImageMetadata -> factory.Create(...)) the user-provided icon path does not appear to be propagated into the final AppImage metadata/plan. It's possible BuildUtils.CreateMetadata does not convert setup.Icon into PackageMetadata, or AppImageOptions/IconNameOverride is not set from the CLI option.

Possible causes (for maintainer reference)

  • The CLI parsing of --icon may not populate FromDirectoryOptions/Options correctly, so the icon path or contents never reach PackageMetadata.
  • Even if PackageMetadata contains icon info, ToAppImageMetadata or AppImageFactory.BuildPlanInternal might not use it to populate AppImageBuildPlan.IconFiles/IconName.
  • Icon discovery code (e.g., IconInstaller.Discover, which currently returns an empty collection) or other discovery logic may not handle user-supplied absolute paths in some code paths.

Additional information I can provide

  • I can attach the full packaging console log from my run if useful for debugging.
  • I can produce a minimal reproduction case or run any diagnostic commands you suggest.

Suggested fixes (optional)

  • Ensure the CLI parser stores the --icon value in FromDirectoryOptions/Options and that value is passed to BuildUtils.CreateMetadata.
  • In BuildUtils.CreateMetadata, if setup.Icon is present, read the PNG/SVG bytes and populate PackageMetadata.IconFiles / DirIcon / Icon (or set AppImageOptions.IconNameOverride) so the build plan writes the icon files into the AppDir.
  • Confirm AppImagePackager preserves AppImageOptions/IconNameOverride and that AppImageFactory.BuildPlanInternal writes provided icon resources into usr/share/icons/hicolor/… paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions