When I install my application I would like a shortcut to be added to the desktop. How can i do this? I am running Visual Studio 2005 Standard Edition
Thanks
Simon
When I install my application I would like a shortcut to be added to the desktop. How can i do this? I am running Visual Studio 2005 Standard Edition
Thanks
Simon
As asked, the simplest route is the Setup & Deployment project (as and pointed out). Two alternatives are often more robust: create the shortcut at first run from your VB.NET app (avoids installer quirks and UAC surprises), or use a dedicated MSI tool like WiX for better control and repeatable installs.
A compact VB.NET approach (call on first run or from an Installer class). Add a COM reference to "Windows Script Host Object Model" and then:
Imports IWshRuntimeLibrary
Imports System.IO
Public Sub CreateDesktopShortcut(allUsers As Boolean)
Dim desktopPath = If(allUsers,
Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory),
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory))
Dim linkPath = Path.Combine(desktopPath, "MyApp.lnk")
Dim shell = New WshShell()
Dim shortcut = CType(shell.CreateShortcut(linkPath), IWshShortcut)
shortcut.TargetPath = Application.ExecutablePath
shortcut.WorkingDirectory = Application.StartupPath
shortcut.IconLocation = Application.ExecutablePath & ",0"
shortcut.Save()
End Sub Notes and troubleshooting:
Environment.GetFolderPath to choose per-user (DesktopDirectory) vs all-users (CommonDesktopDirectory) — writing to the common desktop requires admin rights; see the .NET docs for details (Environment.GetFolderPath). This complements the Setup project approach recommended by and others: if the setup-project route fails or you need per-user logic, the runtime code above is a reliable fallback.
Jump to Post— ahilan_23 0In the File menu--> New Project Types Tools and Deployement Option in There using that U can create Application Files to Place Program Files ,Start Menu Entry,Desktop Shortcuts and Registry Entry.
Jump to Post— Jx_Man 987when you create a setup, u can make shortcut and place it on desktop folder.
In the File menu--> New Project Types Tools and Deployement Option in There using that U can create Application Files to Place Program Files ,Start Menu Entry,Desktop Shortcuts and Registry Entry.
when you create a setup, u can make shortcut and place it on desktop folder.
When I install my application I would like a shortcut to be added to the desktop. How can i do this? I am running Visual Studio 2005 Standard Edition
Thanks
Simon
In the Setup and Deployment side of VB.NET 2005, there is a "desktop" are where you can place an icon on installation and it will install the icon to the desktop as well as the program file.
In VS 2005 Setup and Deployment Project
Users Desktop Folder is there.
Right Click From that Folder--->Create ShortCut Link in Pop up menu select it-->It Creates an lnk file with Default Name-->Rename it-->Right Click that file IT shows Properies window--->In Icon attribute set the Requires image icon to place in desktop
how would i make a set up file using vb.net 2005? and which file add in set up file in which folder?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.