Is it [still] possible to write a Windows Service such that it can
install /itself/ based on a command-line argument?
I've got my Service (in VB'2005) with its own, integral Installer which
/works/ when fed into InstallUtil but, for .. "Reasons" .. I'd prefer to
"drive" this all from the executable. I can't work out how to "invoke"
the installer[s] from Sub Main of the service. I keep getting
NullReferenceEx ceptions from inside the ServiceInstalle r's Install method:
' Create my service's installer (added via the IDE)
' This invokes initializeCompo nent(), which adds
' /two/ Installers (ServiceInstall er and ServiceProcessI nstaller)
Dim installer as New ProjectInstalle r()
' Something to hold "state" in
Dim state as IDictionary = new Hashtable()
Try
If bInstall Then
installer.Insta ll(state) <- BOOM!
NullReferencEex ception
at System.ServiceP rocess.ServiceI nstaller.Instal l(IDictionary stateSaver)
at System.Configur ation.Install.I nstaller.Instal l(IDictionary stateSaver)
at (namespace) ... Program.SelfIns tallService(Boo lean install)
in (source file) ...\\Program.vb :line 68
Any suggestions?
TIA,
Phill W.
install /itself/ based on a command-line argument?
I've got my Service (in VB'2005) with its own, integral Installer which
/works/ when fed into InstallUtil but, for .. "Reasons" .. I'd prefer to
"drive" this all from the executable. I can't work out how to "invoke"
the installer[s] from Sub Main of the service. I keep getting
NullReferenceEx ceptions from inside the ServiceInstalle r's Install method:
' Create my service's installer (added via the IDE)
' This invokes initializeCompo nent(), which adds
' /two/ Installers (ServiceInstall er and ServiceProcessI nstaller)
Dim installer as New ProjectInstalle r()
' Something to hold "state" in
Dim state as IDictionary = new Hashtable()
Try
If bInstall Then
installer.Insta ll(state) <- BOOM!
NullReferencEex ception
at System.ServiceP rocess.ServiceI nstaller.Instal l(IDictionary stateSaver)
at System.Configur ation.Install.I nstaller.Instal l(IDictionary stateSaver)
at (namespace) ... Program.SelfIns tallService(Boo lean install)
in (source file) ...\\Program.vb :line 68
Any suggestions?
TIA,
Phill W.
Comment