문제

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