Marco,
We use Installer class to create and remove Start menu icons during installation/uninstallation process. Here's what we do:
1. Add reference to the Windows Script Host Object Model (it's a COM object) to the project where you Installer class is.
2. Your install custom step code would have to include something like this:
Code: WshShellClass WshShell = new WshShellClass();
IWshRuntimeLibrary.IWshShortcut myShortcut =
(IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(shortcutPath);
myShortcut.TargetPath = targetPath;
myShortcut.Description = description;
myShortcut.IconLocation = iconLocation;
myShortcut.Save();
where shortcutPath is the path to the .lnk file in the Start menu.
3. Your uninstall custom step would include simple deletion of .lnk files created by the installation step.
Windows Scripting component is normally part of the default system installation, but sometimes (and we found this the hard way) this component is missing for some reason. Because of that, in your Setup project you may want to create a Launch Condition that will search the target system for the Windows Scripting component and will show a message if it's not found:
4. Create a Search Target Machine item in your Visual Studio setup project with following properties:
- Name: WScript.Shell.1
- Property: WSCRIPTSHELL1_CLSID
- RegKey: CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}
- Root: vsdrrHKCR
5. Create a Launch Condition with following properties:
- Name: Windows Scripting Host
- Condition: WSCRIPTSHELL1_CLSID
- InstallUrl:
http://www.microsoft.com...2caa&DisplayLang=en
- Message: Microsoft Windows Script component is not found on this computer. Would you like to download Windows Script component from Microsoft web site?
Please let us know if this has helped.
Best regards,
UltiDev Team.
Please donate at
http://www.ultidev.com/products/Donate.aspx to help us improve our products.