RKP
RKP

Reputation: 5385

install/uninstall of windows services during development

I would like to know if there is an easier way to install or uninstall windows services onto dev or test environments without creating setup packages? I am having issues with uninstalling visual studio packages sometimes (even after stopping the service and closing the service management console before uninstall forcing me to reboot the machine). this issue can be overcome by using tools like InstallShield or WIX to create setup packages, but during development it will be easier if I can install the service (along with all the dependent files) in dev or test environment without creating a setup package.

Upvotes: 2

Views: 1381

Answers (4)

G DeMasters
G DeMasters

Reputation: 61

I know this is an old question, but I feel this information is highly relevant to anyone struggling with this issue:

The problem comes from a change in the Installer included in Visual Studio. I think the change occurred between VS2005 and VS2008. Regardless, after the change, to have an update installer work properly without uninstalling the prior product, it was recommended that Services be installed via Custom Actions in the Install, Commit, and Rollback phase, but not the Uninstall phase. I believe this is because the change caused the Uninstall action to occur after the new version was installed, uninstalling your service upon update. A Condition of "Not PREVIOUSVERSIONSINSTALLED" is placed on the 3 Custom Actions and Check For Previous Versions must be TRUE. This results in essentially the same result as copying the files over the old ones (but also retains any other install activity such as registering objects, etc.)

This all works great for updates; a new version will install over an existing version, the service remains registered, all is well. However, if you uninstall, your service is left registered, and a fresh install will attempt to register it again, resulting in the 1001 error. I use SC.EXE to delete the service manually when I uninstall to avoid this. You can have a clean uninstall, but it will break update installs, your choice.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55620

I find the SC.EXE command to be easy to use during development. Slap it into a NAnt/BuildBuild/Perl/BAT file and instant light weight automation.

Upvotes: 1

Mesh
Mesh

Reputation: 6472

If remember right,( no access to my dev machine at the moment). Stop the service - and replace the exes and dlls) restart the service. You can script this. You will need to do an initial install, or use the installutil.exe

I found this much easier that installing and uninstalling, all the time.

Upvotes: 1

John Koerner
John Koerner

Reputation: 38087

Use installutil, which is part of the .net framework. Now you still need to copy the bin directory to the desired machine and register any COM objects if you are using any.

Upvotes: 2

Related Questions