0

I have a Windows service app in C# and a setup project for installing the service. In the setup project, RemovePreviousVersion is set to true, and the custom actions are all set.

I upgrade the app by running the msi file which will have a higher version number than the installed version. While running the msi, I get a prompt saying the file is in use and asking me to Try Again, Continue or Exit. If I select Continue, the installation will go on happily and ask to restart at the end. This is all fine and expected.

However, I need to do the upgrade unattended by running the msi with msiexec using the /quiet option, which will fail and according to the log, the problem is due to file in use.

How can I install a msi unattended using msiexec if a file is in use? I am looking for a way of getting msiexec to work unattended rather than doing all the work myself stopping my service, etc.

Matt Davis
  • 45,297
  • 16
  • 93
  • 124
Lap
  • 254
  • 2
  • 9
  • Sounds like the service is still running when you try the new install. I haven't worked with msi installations, so is there a way to add code that will stop the service using System.ServiceProcess.ServiceController before attempting the update? I personally use the technique of having the service install/uninstall itself from the command line, but it's a manual process. Details are here: http://stackoverflow.com/questions/1195478/how-to-make-a-net-windows-service-start-right-after-the-installation/1195621#1195621 – Matt Davis Jun 23 '11 at 16:19
  • The problem I have is that if I do not use the /quiet flag, even though the service is running, the update will work fine, but it brings up a dialog box which someone needs to manually deal with. So msiexec is able to handle file in use. My main requirement of doing this unattended sounds like it should be possible with msiexec without adding any code. – Lap Jun 27 '11 at 09:20

1 Answers1

0

Try your re-installation after stopping the previous running service.

    control panel->Administrative tools->services

select your service from the opened service listing window and stop your service.

Hope this solves your problem.

Harun
  • 5,109
  • 4
  • 38
  • 60