Search code examples
c#iconsexetray

C# how add icon into .exe


How can I import .ico into .exe in c# ? (I want to have only one file)

In resources file I have: icon.ico

When i click on that icon, in properties I have: "Embedded Resource"

What I shoud do(change)?

trayIcon.Icon = new Icon("c:\\users\\wulp\\documents\\visual studio 2013\\Projects\\WifiSwitch\\WifiSwitch\\Resources\\icon.ico");

and, how I have to use relative path ?

thanks


Solution

  • You have to add your icon as a resource.

    See: https://msdn.microsoft.com/en-us/library/7k989cfy(v=vs.80).aspx

    When you've added it as a resource you can point to it.