I'm trying to change the application icon from default to something else.
So what I did, is I made an icon and saved it. Then I went to the application tab in the property of my project and changed the icon. There he shows the icon like I made it, but when I run my project it shows a gray icon instead of showing my icon.
What i'm doing wrong here?
Run it not through Visual Studio - then the icon should look just fine.
I believe it is because when you debug, Visual Studio runs <yourapp>.vshost.exe
and not your application. The .vshost.exe file doesn't use your icon.
Ultimately, what you have done is correct.
- Go to the Project properties
- under Application tab change the default icon to your own
- Build the project
- Locate the .exe file in your favorite file explorer.
There, the icon should look fine. If you run it by clicking that .exe the icon should be correct in the application as well.
The Icon property for a project specifies the icon file (.ico) that
will be displayed for the compiled application in Windows Explorer and
in the Windows taskbar.
The Icon property can be accessed in the Application pane of the
Project Designer; it contains a list of icons that have been added to
a project either as resources or as content files.
To specify an application icon
- With a project selected in Solution Explorer, on the Project menu
click Properties.
- Select the Application pane.
- Select an icon (.ico) file from the Icon drop-down list.
To specify an application icon and add it to your project
- With a project selected in Solution Explorer, on the Project menu,
click Properties.
- Select the Application pane.
- Select Browse from the Icon drop-down list and browse to the
location of the icon file that you want.
The icon file is added to your project as a content file and can be
seen on top left corner.
And if you want to show separate icons for every form you have to go to each form's properties, select icon attribute and browse for an icon you want.
Here's MSDN link for the same purpose...
Hope this helps.
If you are using Forms
you can use the icon setting in the properties pane. To do this select the form and scroll down in the properties pane till you see the icon setting. When you open the application it will have the icon wherever you have it in your application and in the task bar
Your application icon shows in the taskbar. The icon on the topleft (window) is the form-icon. Go to your form and fill the property "icon" with the same icon; problem solved. You don't need to put the icon in the outputfolder (that's just for setups).
Go to form's properties, ICON ... Choose an icon you want.
EDIT: try this
- Edit App.Ico to make it look like you want.
- In the property pane for your form, set the Icon property to your
project's App.Ico file.
- Rebuild solution.
And read this one icons
If your designated icon shows when you run the EXE but not when you run it from Visual Studio, then, for a WPF project add the following at the top of your XAML: Icon="Images\MyIcon.ico". Put this just where you have the Title, and xmlns definitions.
(Assuming you have an Images folder in your project, and that you added MyIcon.ico there).
Build the project
Locate the .exe file in your favorite file explorer.
you should put your icon on the project folder, before build it
I had the same problem. I followed the steps to change the icon but it always installed the default icon.
FIX: After I did the above, I rebuilt the solution by going to build on the Visual Studio menu bar and clicking on 'rebuild solution' and it worked!