I want when user runs my c# application , the application will create a desktop shortcut to run application. I use this code :
private void appShortcutToDesktop(string linkName)
{
string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url"))
{
string app = System.Reflection.Assembly.GetExecutingAssembly().Location;
writer.WriteLine("[InternetShortcut]");
writer.WriteLine("URL=file:///" + app);
writer.WriteLine("IconIndex=0");
string icon = app.Replace('\\', '/');
writer.WriteLine("IconFile=" + icon);
writer.Flush();
}
}
private void button1_Click(object sender, EventArgs e)
{
appShortcutToDesktop("MyName");
}
This code creates shortcut but I want to put myicon.ico
for shortcuts icon .
how can I do this ?