I am using VS2010 installer to create an installer for my application named as App2. if the previous version of my app (names as App1) is already installed on the user’s machine the installer will overwrite the files. I want my installer to delete the App1 shortcut from the start menu if it exits. Is there any approach to achieve this?
Share
I found the answer here : <How to remove a shortcut file in c#>
so I wrote the following in a custom actions/Commit():
string startMenuDir = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);string shortcut = startMenuDir + @"\Programs\Companyname\App1.lnk";
if (File.Exists(shortcut))
File.Delete(shortcut);