Windows services unanswered recurring question

V

vmantrana

Hi guys:

I have a question about windows services, I have been trying to find
the answer but only found the same question from 3 years ago with no
response.
I wish you guys can help me with this....

..............................................................
Question posted by: Jacob Callcut (Guest) on November 15th, 2005
06:42 AM
To All,

When creating a Windows Service and selecting the "Add Installer"
option from the right-click menu in the service's design window, a
"ServiceProcessInstaller" and "ServiceInstaller" are automatically
created. Does anyone know if there is a way to customize what "Add
Installer" does? .....
.......................................................................................................

What does "Add Installer" ACTUALLY do behind the scenes?

Thanks...
 
M

Morten Wennevik [C# MVP]

vmantrana said:
Hi guys:

I have a question about windows services, I have been trying to find
the answer but only found the same question from 3 years ago with no
response.
I wish you guys can help me with this....

..............................................................
Question posted by: Jacob Callcut (Guest) on November 15th, 2005
06:42 AM
To All,

When creating a Windows Service and selecting the "Add Installer"
option from the right-click menu in the service's design window, a
"ServiceProcessInstaller" and "ServiceInstaller" are automatically
created. Does anyone know if there is a way to customize what "Add
Installer" does? .....
.......................................................................................................

What does "Add Installer" ACTUALLY do behind the scenes?

Thanks...

Hi,

Short and simple answer, it auto generates new files. If you are looking
for ways to do this yourself, you need to extend visual studio in some way.
This page might be a good starting point to learn about this.

[Resources about Visual Studio .NET extensibility]
http://www.mztools.com/resources_vsnet_addins.aspx
 
V

vmantrana

Hi,

Short and simple answer, it auto generates new files. If you are looking
for ways to do this yourself, you need to extend visual studio in some way.
This page might be a good starting point to learn about this.

[Resources about Visual Studio .NET extensibility]http://www.mztools.com/resources_vsnet_addins.aspx

Thanks for the information. I think my question is actually centered
on how the service class and the ProjectInstaller class (which
contains the "ServiceProcessInstaller" and "ServiceInstaller") are
tied. This is probably a non-practical question...
Thanks.
 
J

Jeff Winn

Hello!

The service class itself is really nothing more than a object that derives
from the ServiceBase class which contains necessary members needed for
services to start, stop, and other various functions.

The installer class you need to add to your project is (assuming you have
the RunInstaller attribute decorating the class and set to true) will cause
the installutil.exe to locate the installer and use it during the
installation process. This is where the ServiceInstaller and
ServiceProcessInstaller objects you had to add to your installer file come
into play.

Those files tell the installer what settings to use while the service is
being installed on the target machine. Which account the service needs to
run as, any description about the service, and other pieces of information.
Those objects are then used during the pinvoke calls (done within the
ServiceInstaller class) needed by the installer to actually perform the
installation. If you're curious about what's going on behind the scenes
during the install, simply use .NET Reflector on the
System.ServiceProcess.ServiceInstaller class located in the
System.ServiceProcess assembly.

Hopefully that answers your question. :blush:)

- Jeff

vmantrana said:
Hi,

Short and simple answer, it auto generates new files. If you are looking
for ways to do this yourself, you need to extend visual studio in some
way.
This page might be a good starting point to learn about this.

[Resources about Visual Studio .NET
extensibility]http://www.mztools.com/resources_vsnet_addins.aspx

Thanks for the information. I think my question is actually centered
on how the service class and the ProjectInstaller class (which
contains the "ServiceProcessInstaller" and "ServiceInstaller") are
tied. This is probably a non-practical question...
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top