Marteng
Marteng

Reputation: 1305

How can I change the icon of a Console App in Visual Studio Code?

I have a .NET 3.1 console application. I use the Visual Studio Code IDE. I build the executable with dotnet publish (+ some arguments) from command line. I want the built .exe file to have my custom icon (.ico file).

What do I need to do to have the built .exe my custom icon?

Upvotes: 3

Views: 2931

Answers (1)

Ceemah Four
Ceemah Four

Reputation: 518

  • 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

Upvotes: 8

Related Questions