Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add a custom desktop icon 1

Status
Not open for further replies.

vatawna

Programmer
Feb 24, 2004
67
US
Does anyone know how to add a custom icon to a c# project, so that after it is packaged then users install the application, the custom icon (instead of the default one) will be displayed on desktop?

Thanks.
 
Here is one solution:
1.On the Project Properties->Add ->Add Existing Item.
2. Browse the .ico file to locate it or have it already copied into the project directory.
3. Now in solution explorer you should have that file, let say myfile.ico.
4. Right Click on myfile.ico ->Properties -> Build Action -> Embedded Resource
5. In the code :
mainForm.Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("YourAssembly.myfile.ico"), 16, 16);
6. Build the project
7. Create a installer project Setup and Deployment Projects->Setup, give a name and location.
8. Set the File System on Target machine entries:
- Application Folder - add the exe and other required files such dll, .config etc
- User's Desktop - name the shortcut to be be displayed on the desktop. Set the following properties: Icon (browse myfile.ico), Target - the exe file ...
- User's Programs Menu - name the entry to be displayed in Start->All Programs . Set the following properties: Icon (browse myfile.ico), Target - the exe file ...
Be sure to set AlwaysCreate to True for the the User's Desktop and User's Programs Menu entries.
9. Build the installer project
10. Under My Project Installer/Debug or /My Project Installer/Release , there are created Setup.exe, My Project Installer.msi and Setup.ini which are used now to install the project.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top