Question

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?

Was it helpful?

Solution 2

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);

OTHER TIPS

best way would be to not rename your app, and use the versioning in the assembly. Then you would not need to delete the shortcut, as it would still open the new version of the app.

There is actually no guarantee that you deleted all shortcuts, as window users can create/duplicate/move/rename shortcuts at any time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top