views:

62

answers:

3

I need to register an existing third-party executable (database engine) Windows service from a .NET application. Is there a better way than writing to the registry?

+1  A: 

installutil.exe is a better choice than manually writing to the registry, if that's what you're asking. If you're looking to do it programatically (through, say, a custom install action in an MSI), you may be able to use classes in the System.Configuration.Install namespace, specifically AssemblyInstaller.

Adam Robinson
+1  A: 

You could also wrap the sc.exe command line tool.

Alex Peck
A: 

This CodeProject item might be of interest, it gives some nice code and explains how to use installutil.exe from an installer (MSI) or from within your .net code.

http://www.codeproject.com/KB/cs/DynWinServiceInstallUtil.aspx

Frozenskys