EDIT Jun 2010: The MSI I created was under VS 2005 on Windows XP. When I tried to use the same MSI to install/uninstall under Vista, the uninstall was not very clean. I have not assessed the extent or cause, but I don't recommend using this solution on Vista without further investigation.
ORIGINAL POST:
I've still not found a real solution to my problem although the workaround -- a bit of a hack -- works well enough for my purposes. I found the suggestion on some other site (I will post a link to it if I can ever find it again).
I created a VBS file that has two functions: one creates a shortcut and the other creates the directory structure as necessary. When the file executes, it calls MakeShortcut as many times as the developer sees fit.
The second VBS file works the same way but deletes the shortcuts.
I call the first file as part of a Custom Action (right click on Setup project, VIEW, CUSTOM ACTIONS) in the Install folder. I call the second in the Uninstall folder.
The problem is that the two VBS files get installed into the target directory as well as the rest of the program. There is probably a way to get rid of them but I really don’t care that they stay there. Again, this is a bit of a hack and not as elegant as I was hoping but it works well enough until I can find a better solution.
Here are the two files in case anyone wants to use them:
'CREATE SHORTCUTS.VBS
MakeShortcut "%AllUsersProfile%\Start Menu\Programs\My Prog Folder", _
"My Prog", _
"%ProgramFiles%\My prog\prog.exe"
Function MakeShortcut (location, text, target)
Dim objShortcut
Dim objShell
Dim expLocation
Set objShell = CreateObject("WScript.Shell")
expLocation = objShell.ExpandEnvironmentStrings(location)
expTarget = objShell.ExpandEnvironmentStrings(target)
MakeDirectory(expLocation)
set objShortcut = objShell.CreateShortcut(expLocation & "\" & text & ".lnk")
objShortcut.TargetPath = expTarget
objShortcut.Save
End Function
Function MakeDirectory (newPath)
Dim objFSO
Dim arrPath
Dim length
Dim count
Dim path
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(newPath) Then
Exit Function
End If
path = ""
count = 0
arrPath = split(newPath, "\")
length = ubound(arrPath)
While count <= length
path = path + arrPath(count) + "\"
count = count + 1
If Not objFSO.FolderExists(path) Then
objFSO.CreateFolder(path)
End If
Wend
End Function
DELETE SHORTCUTS.VBS
DeleteShortcut "%AllUsersProfile%\Start Menu\Programs\My Prog Folder", _
"My Prog.lnk", _
True
Function DeleteShortcut (location, shortcut, delLoc)
Dim objShortcut
Dim objShell
Dim expLocation
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
expLocation = objShell.ExpandEnvironmentStrings(location)
DeleteDirectory(expLocation)
If objFSO.FileExists(expLocation) Then
objFSO.DeleteFile expLocation & "\" & shortcut
End If
If delLoc = True Then
DeleteDirectory location
End If
End Function
Function DeleteDirectory (path)
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(path) Then
objFSO.DeleteFolder path, True
End If
End Function