Here’s a great post on how to add a desktop shortcut to ClickOnce Deployed Application. (Scott Schecter’s post)
http://blog.scottschecter.net/TheZenOfTheClickOnceDeployedApplicationDesktopShortcut.aspx
Here’s the version of this solution in VB. (Julia Lerman’s post)
http://blog.ziffdavis.com/devlife/archive/2006/07/28/42695.aspx
If you don’t want to follow the link, here’s the code:
/// <summary>
/// This will create a Application Reference file on the users desktop
/// if they do not already have one when the program is loaded.
// If not debugging in visual studio check for Application Reference
// #if (!debug)
// CheckForShortcut();
// #endif
/// </summary
void CheckForShortcut()
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
if (ad.IsFirstRun)
{
Assembly code = Assembly.GetExecutingAssembly();
string company = string.Empty;
string description = string.Empty;
if (Attribute.IsDefined(code, typeof(AssemblyCompanyAttribute)))
{
AssemblyCompanyAttribute ascompany =
(AssemblyCompanyAttribute)Attribute.GetCustomAttribute(
code,
typeof(AssemblyCompanyAttribute));
company = ascompany.Company;
}
if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute)))
{
AssemblyDescriptionAttribute asdescription =
(AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(
code,
typeof(AssemblyDescriptionAttribute));
description = asdescription.Description;
}
if (company != string.Empty && description != string.Empty)
{
string desktopPath = string.Empty;
desktopPath = string.Concat(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
"\\", description, ".appref-ms");
string shortcutName = string.Empty;
shortcutName = string.Concat(
Environment.GetFolderPath(Environment.SpecialFolder.Programs),
"\\", company, "\\", description, ".appref-ms");
System.IO.File.Copy(shortcutName, desktopPath, true);
}
}
}
Hope it helps out.
Thanks,
Murray