且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在卸载C#windows窗体应用程序之前运行代码?

更新时间:2023-10-14 12:56:10

Microsoft ClickOnce 技术可以自动为您完成此操作,请参阅以下文章:

ClickOnce - 快速部署,安装和更新基于Windows的客户端应用程序的步骤 [ ^ ]

所有你需要的一个 - ClickOnce爱情故事 [ ^ ]


ClickOnce的唯一限制是你的应用程序安装在一个安全的单独用户目录中。

但是有办法绕过这个:http://matijabozicevic.com/blog/wpf-winforms-development/running -a-clickonce-application-as-administrator-also-for-windows-8 [ ^ ]




上面的答案不是你要求的,我想这会回答你的问题:

c# - 在注册表中禁用启动程序; - 堆栈溢出 [ ^ 一>

I need to remove the program from Windows startup on uninstall.

What I have tried:

Installer.AfterUninstall Event

but i cant use it well

Microsoft ClickOnce technology can do this automatically for you, see these articles:
ClickOnce - Quick steps to Deploy, Install and Update Windows Based Client Applications[^]
and All You Need Is One - A ClickOnce Love Story[^]

The only limitation of ClickOnce is that your application is installed in a safe separate user directory.
But there are ways to circumvent this: http://matijabozicevic.com/blog/wpf-winforms-development/running-a-clickonce-application-as-administrator-also-for-windows-8[^]


The answer above is not what you asked for, I think this will answer your question:
c# - Disable startup program in registry; - Stack Overflow[^]