卸载时的自定义操作(单击一次)- 在 .NET 中
对于使用 ClickOnce 安装的 .NET 应用程序,是否有任何方法可以在卸载过程中运行自定义操作。
具体来说,我需要删除一些与应用程序相关的文件(我在第一次运行时创建的文件)并在卸载过程中调用 Web 服务。
有任何想法吗?
For a .NET application installed using ClickOnce, is there any way to run a custom action during the uninstall process.
Specifically, I need to delete a few app related files (which I created on first run) and call a web service during the uninstall process.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ClickOnce 在 HKEY_CURRENT_USER 中安装卸载注册表项,ClickOnce 应用程序可以访问该注册表项。
具体位置是“HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”
您必须使用应用程序的 DisplayName 来搜索该键。
然后您可以包装正常的卸载操作,
ClickOnce installs an Uninstall registry key in HKEY_CURRENT_USER which is accessible to your ClickOnce application.
The specific location is "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
You will have to search for the key with the DisplayName of your Application.
You can then wrap the normal uninstall action,
ClickOnce 本身无法做到这一点,但您可以创建一个标准的 Setup.exe 引导程序来安装 ClickOnce 应用程序并具有自定义卸载操作。
请注意,这会在“添加/删除程序”中创建两个条目,因此您需要隐藏其中一个条目(clickonce 应用程序)。
您的最后一个问题将是 clickonce 上没有“静默卸载”选项,因此您可以执行以下操作:(
找到 此处)
There is no way to do that with ClickOnce itself, but you can create a standard Setup.exe bootstrapper that installs the ClickOnce application and which has a custom uninstall action.
Note that this however this creates two entries in the Add /Remove programs, so you need to hide one of the entries (the clickonce app).
Your final problem will then be that there is no "silent uninstall" option on clickonce, so you could do something like this:
(Found here)