简体   繁体   中英

How can I create an uninstall link in start menu for a ClickOnce application

Clickonce creates only a link in the start menu to run the application. I also want to create an uninstall link when a user installs my C# application using ClickOnce, preferably in the same submenu and next to the link for launching the application. (I am aware that it can be done with Add/remove programs, but it is a hassle to go there for every small application)

Background : I have created a series of quantitative finance related calculators in my website, which are deployed using ClickOnce. The apps are for educational purpose, and user would want to remove it after a couple of days, or immediately if it was not what he was looking for. So I want to make uninstall easy

ClickOnce won't add this shortcut for you. ClickOnce will create a shortcut to launch your app and a shortcut to your help url, that's it. If you want that shortcut created, you'll have to do it yourself in your app's code.

Basically, all you need to do is look in the registry at... HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\[Your app's key]\\UninstallString

Creating a shortcut out of that value (rundll32.exe dfshim.dll...) will accomplish what you want. However, as PetPaulson pointed out in the comments, this shortcut won't be removed by the ClickOnce uninstall. It will remain in their start menu; not good.

That said, I personally don't think it's worth the effort. I really dislike apps that create all sorts of shortcuts (start menu, desktop, uninstall, etc) for me. Most people know how to use Add/Remove Programs. Just my personal preference, though.

Microsoft discourages this in its directives. Uninstallers should be accessible primarily from the "Add/Remove programs" dialog.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM