在卸载自定义动作(的ClickOnce) - 在.NET [英] Custom action on uninstall (clickonce) - in .NET
问题描述
对于.NET应用程序安装使用ClickOnce,有没有什么办法来运行在卸载过程中自定义操作。
For a .NET application installed using ClickOnce, is there any way to run a custom action during the uninstall process.
具体而言,我需要删除一些应用程序相关的文件(这是我第一次运行创建),并在卸载过程中调用Web服务。
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.
任何想法?
推荐答案
有没有办法做到这一点使用ClickOnce本身,但您可以创建一个标准的Setup.exe引导程序的安装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.
请注意,这可是这造成两个条目中的添加/删除程序,所以你需要隐藏的项目之一(的ClickOnce应用程序)。
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).
您最后一个问题将有上的ClickOnce没有静默卸载选项,这样你就可以做这样的事情:
Your final problem will then be that there is no "silent uninstall" option on clickonce, so you could do something like this:
On Error Resume Next
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "taskkill /f /im [your app process name]*"
objShell.Run "[your app uninstall key]"
Do Until Success = True
Success = objShell.AppActivate("[your window title]")
Wscript.Sleep 200
Loop
objShell.SendKeys "OK"
(找到<一href="http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/51a44139-2477-4ebb-8567-9189063cf340"相对=nofollow>这里)
这篇关于在卸载自定义动作(的ClickOnce) - 在.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!