0

In my solution I have WinForms application called JCommander and JCommanderSetupProject. In JCommander Resources folder i have an icon file i want to be placed on Desktop and Start Menu.

How i do that?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
eugeneK
  • 10,750
  • 19
  • 66
  • 101

2 Answers2

0

From what you've said, I think you're talking about an application shortcut, which is the icon you normally find on your desktop, start menu or quick-start bar, if I'm mistaken please tell me.

There's some responses at Creating application shortcut in a directory which answer your question.

The main answer is to use ShellLink.cs, which takes care of everything for you after you give it whatever parameters it needs. (You might need to import it into a separate project and edit some parts).

Example:

private static void configStep_addShortcutToStartupGroup()
{
    using (ShellLink shortcut = new ShellLink())
    {
        shortcut.Target = System.Reflection.Assembly.GetExecutingAssembly().Location;
        shortcut.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
        shortcut.Description = "Shortcut To My Application";
        shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
        shortcut.IconPath = "/Path/to/icon.ico";
        shortcut.Save(Environment.SpecialFolder.Desktop + @"\My Shortcut.lnk");
    }
}
Community
  • 1
  • 1
K893824
  • 1,279
  • 8
  • 21
0

Open your project, click the project menu, and select project properties. Then, under the application tab, there is a place to browse for your icon. you can create action on your setup project to create short cut for the application.

Damith
  • 62,401
  • 13
  • 102
  • 153