Uninstall Windows C # Application

How can I remove the currently executing C # application?

I just wanted to make it user friendly. This is only a small program, if they install it and don’t like it, I don’t want to force them to overcome problems with adding / removing, just by pressing the quick access button. He had (you are sure) a dialogue to stop accidents, but besides that, I thought it would be good.

Sorry, without specifying the installation software, I am using Visual Studio 2008 and its accompanying publish function, which I installed as the Windows 3.1 installer.

Process.Start gives me compilation errors and is not recognized by VS. tried the system. also, but I use the system, so it should not have mattered

+2
source share
3 answers

Since you said about uninstallation, I must assume that you used the installer to install your program in the first place.

It is also assumed that you used the Windows Installer (MSI), as you did not specify otherwise. If it is so simple:

1) In the button click handler, run this command using Process.Start: msiexec.exe / x [your product code]

http://msdn.microsoft.com/en-us/library/aa367988(VS.85).aspx

2) Exit the program immediately (Environment.Exit or any other mechanism)

However, I will need to ask why you need to do this, as this is a rather unusual behavior.

+3
source

Well, firstly, how does he set it up?

, #, . , .

+1

This is not a bad idea, but it is rather non-standard; even the ClickOnce application cannot self-learn, the Add or Remove Programs tool is really where it belongs.

0
source

Source: https://habr.com/ru/post/1796553/


All Articles