Adding an icon to my finished application - c#

What's the proper way to add an icon to my application? I mean to the actual physical .exe file.

In Visual Studio, right click your project (the one that is compiled to an exe), choose Properties, under the Application Tab, in the "Icon and manifest" section, change your icon.

Related

Set icon of Users Desktop/Program Menu from MSI Installer

I have made an msi installer through The Microsoft Installer Projects addon/Nuget. I am trying to set the icon of the shortcut to the User Desktop/Program Menu through Visual Studio however it defaults to the Microsoft standard executable icon when the program is installed.
Right clicking the deployment project -> View -> File System -> User's Desktop or User's Program Menu > Create a new shortcut.
Right clicking the shortcut -> Properties Window -> Change the Icon under "Icon".
I have tried to select the primary output from project file, as well as adding the .ico file to the Application folder under "File System on Target Machine", and selected that. In the image below I select the ico file from the File System on the target Machine
For reference picture
In my primary output project file in the forms code I have also added:
this.Icon = Project.Name.Properties.Resources.Logo;
I have done the same to the NotifyIcon.
I have also added the same icon in the Forms Design Menu (though probably not necessary).
The executable itself shows the icon on both the taskbar and tasktray. The taskbar icon takes on the default icon instead of the one I picked whenever I add a shortcut to the "User's Programs Menu".
Not the right icon

How to change Setup.exe icon when publishing through clickonce

Is there any way to set custom icon for setup.exe file when publishing through VS for click once publish.
Always after publishing, I am getting setup.exe file and with the icon (kind of black disc image) but after installing the application, I can see my custom logo on the startmenu,ctrlpanel.
I'm not aware of any way to change the icon BEFORE building the project so that once the ClickOnce is deployed it already has the icon, however you can edit the setup.exe icon AFTER deployment quite easily. If anyone else knows of a way to do it before then they can trump my answer.
In Visual Studio go to File > Open > File and browse to the setup.exe for your ClickOnce deployment. Open this file.
You should see a folder tree. Right click on the Icon node and choose Add Resource.
It should already have the Icon resource type chosen on the left so click Import on the right to add your icon.
Your icon will open up in Visual Studio, just close this tab. You should be back to your folder tree. Look under the Icon node and make sure your icon has the lowest ID number.
Save the file.
Your setup.exe will now have the new icon.
Disclaimer: For me Windows was weird and didn't refresh the icon right away. If I went to its properties or copied the file elsewhere I could see the icon immediately. I imagine it's a caching thing.
Edit: Screenshot:
Double-click on the properties for your main project.
Click on the Application tab. (I'm assuming C# here. If you're doing VB, post back if it's different and I'll see if it's the same.)
In the middle of the page, there is an option for "icon and manifest".
Browse to find the icon you want to use and select it.
It needs to be in the top folder of your project; I think it will put it there when you select it.
The icon will be deployed with your project, and will be used in the Start Menu. (You can doublecheck the Application Files dialog -- it should be in there marked include(auto)).
You can set the icon on the forms to point to the same icon, and show it on all your forms too.
this link got your answer:
ClickOnce start menu icon

replacing application icon after build

I need to brand a specific white labeled app and it needs to get the appropriate app icon, so that when I browse to the exe in file explorer it shows with the branded icon. I dont mean changing the icon at runtime because that is not a problem.
I have tried accessing the assemblies with mono.cecil and replacing the resource called "app.ico" but it doesnt seem to work. I also tried to use pack URIs in xaml but that doesnt work because at compile time I dont know where the branding resources are located.
I know that this can possibly be done during a pre-build event but I prefer replacing the icon after the exe is built.
Any ideas?
In the 'Solution Explorer' in Visual Studio, select the startup project. Either right click on it and select 'Properties', or just press Alt+Enter on the keyboard to open the project properties. On the 'Application' tab, you should see a 'Resources' section. Click on the 'Icon and manifest' and select an icon for your application. Is that what you were talking about?

How do I embed a banner image and or add remove programs icon in my setup project?

I'm using a setup project in visual studio 2010 to create an installer for a program I'm working on. I want to have a custom banner image in my setup as well as a custom icon in add remove programs.
I've added both these images to the "Application Folder" of my installer and was able to get them to show up correctly. However, my program is not very big and only installs as an EXE and a few DLLs. So it seems a little silly to me that the 4th and 5th files that get "installed" are graphics only used during installation.
Is there some way I can embed these images in the installer or one of my other projects?
I'm currently using VS 2008 and just been playing around with the setup project. I believe the following works - it did in my tests.
Select the setup project in the solution explorer window.
Right click and select Add/File
Find your banner Image file and add it.
You will see that it's been added to the Application folder.
Select the banner file in the application folder - or in the project list on the solution explorer.
Open the Properties Window
On the properties set "EXCLUDE" to TRUE.
When you set exclude to true you will see the banner file removed from application folder - but it will still be shown in the project tree - the icon will for the file will have a little red circle with a line through it.
I've done this with both the banner and a custom icon and tested my install - worked fine with both and neither file showed up in the application folder.
Hope this helps.
In the setup project properties you can put an image for the add/remove icon in the property AddRemoveProgramsIcon
For the banner image, right click on the setup project, View -> User Interface, click on the page you want, and then in the properties you want the BannerBitmap property.
This blog discusses a way to change the banner image without modifying the Visual Studio project.
If you want to change of the icon of the application EXE, then you just need to right click on the EXE and "create shortcut". In the properties you will find the icon and you can change it.

Winforms console application, how can I embed an icon in exe file?

I have a console application, I want to include an ico file as an embedded resource in the exe, then have it as the programs icon in windows explorer, how is this done?
If you right click on your actual project that you want to change the final icon and select properties at the pop-up menu, then the main screen will change to the properties file edit, in the screen that appeared, at the botton you will see that you can select the icon to use in the application, select it and when you compile your project, at the release type you will see that the application have the icon that you selected.
Regards.
In the project settings page for your Console Application, go to the Application Page.
Under "Icon and Manifest", click on the [...] button next to where it says (Default Icon), and pick your Icon. Rebuild your app.
This will give your console application a custom icon.
The icon displayed in windows explorer for any .net application is the assembly icon which can be set in the project settings in visual studio.

Categories