Wednesday, September 01, 2004
Add shortcut for uninstall in the Programs menu.
Your query is incomplete! We need more info to be able to help you.
What exactly is your query? Is it
a. You have added the path to your application as a shortcut under Start->Programs menu and now you want another shortcut named "uninstall application" which will delete all related files for this application?
b. Or you already have an installer project built for your app but when you run the installer, it doesn't add a menu entry for Uninstall ?
c. Or do you want to add your application's uninstall shortcut specifically under the Programs' menu for VS.NET 2003
Now some possible solutions:
For question (a) above, you don't need to write C# code. It can be accomplished using VBScript. Try this sample code :
'--------- code begin-------------
Set WshShell = CreateObject("WScript.Shell")
strProgramsPath = WshShell.SpecialFolders("Programs")
Set objShortcutLnk = WshShell.CreateShortcut(strProgramsPath & "\Uninstall Application.lnk")
objShortcutLnk.TargetPath = "my uninstaller.exe"
objShortcutLnk.Save
'---------code end ------------------
Save the above code to some file with vbs extension. Change "my uninstaller.exe" to refer to the uninstaller which you have created.
The above snippet creates a shortcut only for the current user. For All users, replace "Programs" above with "AllUsersPrograms"
b. In case you are not satisfied with VS.NET's inbuilt installer, you might want to try out one of the installers listed here:
http://www.sciencedaily.com/directory/Computers/Software/System_Management/Installers
c. Are you sure you want to do this? :)
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
What exactly is your query? Is it
a. You have added the path to your application as a shortcut under Start->Programs menu and now you want another shortcut named "uninstall application" which will delete all related files for this application?
b. Or you already have an installer project built for your app but when you run the installer, it doesn't add a menu entry for Uninstall ?
c. Or do you want to add your application's uninstall shortcut specifically under the Programs' menu for VS.NET 2003
Now some possible solutions:
For question (a) above, you don't need to write C# code. It can be accomplished using VBScript. Try this sample code :
'--------- code begin-------------
Set WshShell = CreateObject("WScript.Shell")
strProgramsPath = WshShell.SpecialFolders("Programs")
Set objShortcutLnk = WshShell.CreateShortcut(strProgramsPath & "\Uninstall Application.lnk")
objShortcutLnk.TargetPath = "my uninstaller.exe"
objShortcutLnk.Save
'---------code end ------------------
Save the above code to some file with vbs extension. Change "my uninstaller.exe" to refer to the uninstaller which you have created.
The above snippet creates a shortcut only for the current user. For All users, replace "Programs" above with "AllUsersPrograms"
b. In case you are not satisfied with VS.NET's inbuilt installer, you might want to try out one of the installers listed here:
http://www.sciencedaily.com/directory/Computers/Software/System_Management/Installers
c. Are you sure you want to do this? :)
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/