سؤال

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