Click here to Skip to main content
15,033,111 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hi All,

My winform application is developed in VS 2008, I have created setup from setup and deployment projects.

Problem: User can uninstall my app from add/remove programs, even if it is running.

OS on which i have installed my application is XP.

Thanks
Nitin
Posted
Comments
Albert Holguin 18-Jun-11 12:23pm
   
That's an interesting problem... I've never tried that but my initial thought is exactly what Christian said, "how can that happen?". My 5 for the question.
Sergey Alexandrovich Kryukov 18-Jun-11 18:50pm
   
Do you want to uninstall it even when it's running, and this is a problem, or the problem is that you don't want it but that happens?
--SA

You can delete executable modules of some application only if the application is not running, so you need to abort the execution first.

You can do it by using the method System.Diagnostics.Process.Kill. See http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=VS.90).aspx[^].

—SA
   
Comments
Nitin_Verma 20-Jun-11 7:47am
   
Hi SAKryukov
Thanks for replying, but i already Know how to start or stop local system processes. But my problem :

I have created setup of my app from setup project VS. I install my application. and now when my application is running, user is able to uninstall it from add/remove programs. even after uninstalling my application is still running.

Nitin Verma
   
OK, I suspected that, but did not dare to assume this is what you really want. So, do you to run uninstalled application? What do you mean by "uninstalling" in this case?
Did you vote by 1 just because the answer does not give you the solution you need? :-)
--SA
Nitin_Verma 4-Jul-11 6:10am
   
M sorry SAKryukov for the vote actually vote was clicked by mistake.

uninstall means user goto control panel => add remove programme => remove my application, without any warning, even when it is running. I dont want user to do so.

Thanks in advance for answering.Nitin Verma
   
I don't know... the vote is still 1. If you think this is a mistake, you can re-vote again anytime (may need to refresh the page in the browser).

Now, about uninstall. You specified you need to uninstall. You explain me the uninstall you don't need. It's nothing; what you describe simply runs your uninstallation application as it is registered. I was asking about what do you mean the uninstallation you really need. What should it do? You see, if you want to uninstall something without removing executable file, what is "uninstalls"? I don't say this is incorrect: you could remove unwanted Registry entries, use local application data files, etc. But I need to know what do you think it should do. In this case you would not ask the question. So far, it looks to me that you want to remove the executable file and does not want (because you want it running) at the same time. When you say "I already know how to start or stop local system processes", I'm not sure. Do you understand that you cannot delete executable files of running processes, ever?

--SA
You want to be able to do that ? You shouldn't be able to, the app is running, so how can it be deleted ?
   
Comments
Nitin_Verma 18-Jun-11 4:18am
   
don't know how and why, but unfortunately its happening.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900