0

This is a setup for a program running in the taskbar. It starts every time the user logs in.

I cannot simply upgrade a program with a Visual Studio Setup, so I must first uninstall the previous version. (EDIT: It has to be a different version, in other words it has to be compiled at a different time. If it is the same version it gives the Repair/Remove dialogue.)

When I uninstall, I expect the installer to kill the previous instance, or ask the user to manually terminate it. Instead, it wants to restart it, so the new installation fails to launch the application.

Is there a setting to change this?

Peet Brits
  • 2,911
  • 1
  • 31
  • 47

2 Answers2

0

So I assume it cannot be done.

My current workaround is execute a custom program on install, which executes a shell command to kill all running processes with the TASKKILL command. (Starting a batch file is also an option.)

NOTE:

  • I have to do this on install. Doing this on uninstall makes no difference, because the uninstaller checks for running processes before performing the custom actions. Although I still have a running instance after install, at least the new installer will be able to start the latest version.
  • The InstallerClass option on the custom event properties must be false.

EDIT: The only problem with this is that the installer starts a .vshost.exe instance of my "killer" app, and it restarts itself when killed. It only goes away once you log off the machine. Nothing breaks, but my inner perfectionist finds it annoying.

EDIT: Another problem is that some virus programs may not like this, and you have to accept it as trusted.

Community
  • 1
  • 1
Peet Brits
  • 2,911
  • 1
  • 31
  • 47
  • Can you point me on a way on how to execute a shell command from Visual Studio setup project ? – Naveed Butt May 24 '16 at 11:44
  • I created another project (a console application) that only executes the shell command and exits, and then I added this project / executable as a custom action on the setup. It's probably a bit messy, but it was the best solution I had at the time. – Peet Brits May 25 '16 at 12:30
0

Ok, a belated answer with perhaps a solution. You seem to say that the progam cannot be 'killed'; let it run and in the meantime install the mycrosoft process explorer that can be downloaded through the procedure page at this address http://www.javelin-tech.com/blog/2012/02/file-is-open-in-another-program/

It is excellent: I was able to remove previously hidden files; basically for the hard way ones, it tracks their movement wherever they run...and if dormant the claim is it can find it also. What else...good luck if you (still) need it!

I think by now though you should have it anyway...for what it's worth!

James

James
  • 1
  • This answer seems to be geared towards an end user whereas the question is from a developer perspective. – Burhan Ali Aug 14 '13 at 21:35
  • As Burhan said, I'm looking for a developer solution, but thanks for the link! I always wondered if there was such a program. – Peet Brits Aug 26 '13 at 10:37