Home > OS >  How can I export exe with custom icon?
How can I export exe with custom icon?

Time:10-30

I can already export a Visual Studio c# program to a single file exe. What I was curious about is if anyone knows of the console tag for adding a image to the exe or if I would have to do that in the properties beforehand. I tried in properties and it didn't work.

CodePudding user response:

From visual studio in the solution explorer right click on the project and select Properties. From Application tab in Resources grouping select an icon that icon will be applied to the executable file.Properties page

In addition if you would create a setup project and add shortcut to the desktop then you have to separately select an icon for the shortcut. Setup package

CodePudding user response:

XAML

<Window x:Class="WindowSample.MainWindow"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    Title="WPF Window Sample" Height="350" Width="525"  
 Name="FirstWindow" Icon="Icon1.ico" >  

I believe all you have to do is add Icon="" to your <Window>

In this example the custom icon file is in the project folder, and its named "Icon1.ico".

  • Note that the icon image file has to be a .ico file.
  • Also note that the Icon file location can be changed to your preferences.

If you want even more help you should consider checking out this article.

  • Related