Lullly
Lullly

Reputation: 91

Change icon of generated exe

I'm generating an executable file with VB.NET using CodeDomProvider.

Is there a way to change the icon before the compiler creates the exe file?

Upvotes: 1

Views: 5509

Answers (3)

P1kachu
P1kachu

Reputation: 1077

You can use RessourcesHacker AFTER the generation. Not the easiest way, but it works great

Upvotes: 0

adrianbanks
adrianbanks

Reputation: 82934

You can set the icon of the generated exe by specifying it in the CompilerParameters that you pass to the code provider, using the CompilerOptions property.

Dim parameters As New CompilerParameters()
parameters.CompilerOptions = "/win32icon:C:\full\path\to\icon.ico"

You then pass these parameters to the CompileAssemblyFromSource method. The generated exe will then use the specified icon as its application icon.

Upvotes: 3

Gabe
Gabe

Reputation: 50475

Go into the project properties and select the icon from there. Simple as that.

Upvotes: 0

Related Questions