C# console application icon
You can't specify an executable's icon in code - it's part of the binary file itself.
From the command line you'd use /win32icon:<file>
if that's any help, but you can't specify it within the code of the application. Don't forget that most of the time the application's icon is displayed, your app isn't running at all!
That's assuming you mean the icon for the file itself in explorer. If you mean the icon of the application while it's running if you just double-click the file, I believe that will always just be the icon for the console itself.
How can I change the icon of a Console App in Visual Studio Code?
- Add you custom icon to the project
- Edit your project file in VS Code and app icon like so
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ApplicationIcon>TextTemplate.ico</ApplicationIcon>
</PropertyGroup>
</Project>
In my example, the file is at project root.
if you place it in a subfolder, you might need to deal with the path accordingly
Console application icon will not update
I tried clearing the windows thumbnail cache but that did not work.
http://www.addictivetips.com/windows-tips/clear-delete-the-thumbnail-cache-in-windows-7/
I then tried rebuilding the windows icon cache which fixed the problem.
http://www.sevenforums.com/tutorials/49819-icon-cache-rebuild.html
Open command prompt as an administrator and enter the following commands:
taskkill /IM explorer.exe /F
CD /d %userprofile%\AppData\Local
DEL IconCache.db /a
shutdown /r /f /t 00
This will restart your machine.
Related Topics
Custom Sort Logic in Orderby Using Linq
How to Create a New Operator in C#
How to Change Pixel Color of an Image in C#.Net
Print HTML Document from Windows Service Without Print Dialog
How to Get Character for a Given Ascii Value
How to Query for an Event Log Details with a Given Event Id
How to Check How Many Messages Are in a Msmq Queue
Why Can't I Do Foreach (Var Item in Datatable.Rows)
Resharper Formatting: Align Equal Operands
Check If Datetime Instance Falls in Between Other Two Datetime Objects
Expression of Type 'System.Int32' Cannot Be Used for Return Type 'System.Object'
Wpf Textblock Memory Leak When Using Font
How to Get the Name of Color While Having Its Rgb Value in C#
Take Screenshot of Multiple Desktops of All Visible Applications and Forms