Newtonsoft.JSON Assembly Package Version Mismatch

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



Leave a reply



Submit