Abhi Shete
Abhi Shete

Reputation: 1

How to add data to registry before installing service using windows installer

I written windows service in c# which reads some data from registry.Then I created windows installer using visual Studio 2010 for that service and also adding data to registry required for service. My problem is installer starts installing service before adding data to installer.I wanted to add data to registry before installing service so that it can use that data.

Upvotes: 0

Views: 841

Answers (2)

Demented Devil
Demented Devil

Reputation: 146

If you use an installer such as WiX (Windows Installer for XML) or Installshield you will be able to write your registry settings as part of the install using standard MSI instructions.

Then when your service starts, the registry settings will be there as expected.

Incidentally using the self-install feature (via Installutil) is handy for debugging and development but not recommended for production installs.

Personally I use WiX for all my installer needs as it is both free and very flexible.

Upvotes: 1

Gerald Versluis
Gerald Versluis

Reputation: 34013

What you are looking for has to do with the InstallerClass

In the InstallerClass you can override a number of events either before, during of after the installation.

Check out this link to get started:

http://devblog.grinn.net/2008/02/windows-services-in-c-part-3-getting.html

Upvotes: 0

Related Questions