Thanks, Eric
Your comments are very usefull, base on you answare I have additional doubt
in wy an Installer class cannot read the .config file of a window service
I'm writing
I want to use dinamic property asignment for the ServiceInstaller class
intance, like
the ServiceName & DisplayName. The code look like this and is into the
InitializeComponents method:
+------------------------------------------------------------------+
System.Configuration.AppSettingsReader configurationAppSettings = new
System.Configuration.AppSettingsReader();
this.m_MonitorInstaller.DisplayName =
((string)(configurationAppSettings.GetValue("key_DisplayName",
typeof(string))));
this.m_MonitorInstaller.ServiceName =
((string)(configurationAppSettings.GetValue("Key_ServiceName",
typeof(string))));
+------------------------------------------------------------------+
At the time to run the InstallUtil to install the service I got this errors:
+------------------------------------------------------------------+
Unable to create an instance of the
GroupEx.FaxMonitorService.Installer.FaxMonit
orInstaller installer type.
System.Reflection.TargetInvocationException: Exception has been thrown by
the ta
rget of an invocation.
The inner exception System.InvalidOperationException was thrown with the
followi
ng error message: The key 'key_DisplayName' does not exist in the
appSettings co
nfiguration section..
An exception occurred during the Install phase.
System.InvalidOperationException: Unable to create an instance of the
GroupEx.Fa
xMonitorService.Installer.FaxMonitorInstaller installer type.
at
System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
at System.Configuration.Install.AssemblyInstaller.Install(IDictionary
savedSt
ate)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.TransactedInstaller.Install(IDictionary
saved
State)
The inner exception System.Reflection.TargetInvocationException was thrown
with
the following error message: Exception has been thrown by the target of an
invoc
ation..
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
bin
der, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binde
r binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at
System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
The inner exception System.InvalidOperationException was thrown with the
followi
ng error message: The key 'key_DisplayName' does not exist in the
appSettings co
nfiguration section..
at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
at
GroupEx.FaxMonitorService.Installer.FaxMonitorInstaller.InitializeComponen
t() in c:\documents and settings\epimlea\my documents\visual studio
projects\gro
upexfaxmonitorservice\faxmonitorinstaller.cs:line 58
at GroupEx.FaxMonitorService.Installer.FaxMonitorInstaller..ctor() in
c:\docu
ments and settings\epimlea\my documents\visual studio
projects\groupexfaxmonitor
service\faxmonitorinstaller.cs:line 33
The Rollback phase of the installation is beginning.
+------------------------------------------------------------------+
I wonder if the InstallUtil tool is looking for some other name of the
assembly?
Thanks for any additional help you can provide.
Regards...