Search code examples
c#icons

c# application icon not used when running


I have two c# applications developed using Microsoft Visual Studio Professional 2022. Both applications have the same icon and the icon is set in the Application properties. When I compile the release executable the correct icon is visible in the file system, however when I run one of the applications the correct icon is shown in the task bar, however the other application doesn't instead it shows the default application icon in the task bar.

I've compared both projects and I really can't see any differences. Can anyone help?


Solution

  • I assume that you are using Windows Forms. If so, then you need to set the Icon in two locations.

    First in in the Application properties under resources (which I think you have done).

    Application properties

    The second is on the main form of the application itself. Select the form, view the properties, and then you will find the Icon under the "Window Style" section.

    Windows Form properties