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?

有帮助吗?

解决方案 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);

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top