How to assign Application Icon that will display in Task bar? - c#

I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with Icon property of Window, Icon gets assigned but still problem is when I run application, task bar Tab initially displays window's icon for unknown file-type and when window-load completes it changes to the Icon assigned. I want Icon there from beginning. Any help?
Edit:
I tried with .csproj --> Properties --> Application Tab --> Icon
and set it to a .ico file. It works but I need to run my application by .exe file. It doesn't work in development environment(while running through visual studio). I need to set Start-Project option then. Is there any other way to solve this problem?

Check the properties of your main Window project.. You should be able to set an icon there.
Update:
Is it such a problem that your icon does not show in debug mode? As long as it works when you deliver the program to your customer, its all alright, not?
On a side note: You could check some things though. Perhaps your icon is not included in your project, or it isnt copied when building to your Debug folder?
Update 2:
You also need to set the Main Form's Icon for it to show in Debug. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.

I had a similar issue and google led me to this article. I forgot one simple thing, and that was my Main Form's Icon. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.

For WPF applications, use the attribute
Icon="Images\Logo.ico"
for the Window element in XAML to have the window show the icon.

I know this is old, but I found that I could get the icon to show in the taskbar in Debug mode if I went to the project's properties and checked the "Enable native code debugging" box on the "Debug" page

That worked for me. In a VB application, go to Debug screen of Project options (of the UI project) and select Enable unmanaged code debugging. Not sure if there are any negative side effects, but it sure showed the icon during debug. Thanks.

This is old but you can also change the shortcut icon in the setup projet, this is what worked for me (when viewing file system by right clicking the setup project).

Related

The application icon remains the same

I made a WPF application (.net core 3.1) and then towards the end I wanted to change the icon, as usual I opened the properties>application and loaded my icon. But it doesn't change anything... remains the same default icon.
The size of my icon is 256x256 and obviously has an .ico format. I tried to delete the folder where the executable is located and to build again, I also tried to run the application without debugging mode, but nothing. I noticed, however, that the main window when you change the Icon attribute updates the window icon. But nothing to do for the .exe file.
Does anyone know how to solve this problem?
P.S. I don't think it's the icon the problem because I tried to load another icon that I used in the past with another WPF application
Right click on your solution in Solution Explorer and click on "Rebuild Solution" or "Clean Solution" followed by "Build Solution".

Taskbar button/icon does not appear properly if it is set to combine

I am facing the issue in windows 7 taskbar button. When set Taskbar Button property to "Always combine" then my winform application (developed using VS 2010) buttons appeared with default icon.
But if I set Taskbar Buttons property to "Never combine" then it appears with correct icon which I have set for my exe application.
Any idea how can I resolve this issue.. it is suppose to come with icon on combine always settings.
Regards,
Subodh
I created a windows forms application in VS 2010. Added an icon (linked to ico file directly - not through resources) to the project properties (Resources -> Icon: -> Browse). The exe used the new icon.
When changing from 'Always combine' to 'Never combine', the same thing you described happened.
I went back to the project and added the same ico file as an icon for the form. Rebuilt and the problem was gone.
It appears that when using 'Never combine', Windows 7 uses the form icon to display elements in the taskbar. While, when using 'Always combine', it uses the program's icon.

C# VS2010 Setup Project makes no Icons and WinXP Error

I created a Setup Project and it works in Windows 7, but no icons are shown in the shortcuts. I added the icons in the Form, in the Setup Project, in the Desktop Icon tab, in the Start menu tab and in the Add/Remove tab. I added the same icon for all the configurations...could it be a problem with the size of the icon?
Another question:
I am getting an error when I try to install it in Win XP computers...I have no messages to post in here, because my WinXP computer opens the VS2010 for debugging and the debugger has nothing to show.
I've had the same problem recently. I've tried setting the shortcut icons to the app main output icon... didn't work. Then I've set added the same icon to the application folder and set to shortcut icons to that... didn't work either. The problem was the icon size. I've generated a multi size icon on https://icoconvert.com/ and behold. All the icons show properly now. Try doing that, maybe it wil fix the problem.

How to apply the icon for my popup window in WPF?

I have created two windows in my project root folder, MainWindow.xaml and PopupWindow.xaml respectively.
Through Project Properties, I managed to set up an icon for the MainWindow but I couldn't find any available settings for my PopupWindow. Therefore, the PopupWindow is still showing the system default icon in the top left corner.
Can anyone tell me where I can set up a customized icon for my PopupWindow?
Many thanks.
Edit:
I guess I made a mistake in the XMAL code previously. :[
Should have been more careful about the code. Anyways, here is the correct one
Icon="/[Your Project Name];component/[Your ICO File Name]"
Are you running in Debug mode in Visual Studio? WPF Windows don't inherit their icon from the application in debug mode. Try Ctrl+F5 ("Start Without Debugging") and see if your icons appear.
not sure but perhaps this helps
http://www.codeproject.com/KB/WPF/WPF_xaml_taskbar_window.aspx

Why does the desktop icon differ from the explorer icon?

For some reason, a very old version of my icon keeps showing up when my application is dropped on the desktop. In the windows explorer (in all zooming levels) the icons is correctly the assembly icon. I specified the correct item in both XAML Window.Icon and in the project settings.
I have deleted the old version of my icon from all folders I can think of, but it still shows up. Also while drag and dropping, the wrong icon is shown. (in the slightly transparent preview window)
I tried cleaning and rebuilding, I tried deleting the obj folder manually...
The original, wrong icon was 16x16. I have built the new version as 32x32, because on the desktop 16x16 is too small.
According to the msdn docs (http://msdn.microsoft.com/en-us/library/system.windows.window.icon.aspx), each .ico file is supposed to incorporate all smaller sizes anyway.
I also checked that I changed the icon for both debug and release configuration.
Thanks for any ideas! :)
Could this be a problem with the IconCache? Try deleting %localappdata%\IconCache.db and restarting Explorer.exe.
Check the Visual Studio properties window for the EXE's project -- you can specify the icon that's written into the EXE at compile time. This is separate from the icon that's assigned to the XAML window at run time.

Categories