0
Answer

Reading from app.config in a Service Installer class

Michael

Michael

16y
7.3k
1
Hi!
I created a new Windows Service in C# and want to set a Service Dependency.
Did it like this:

ServiceInstaller si = new ServiceInstaller();
si.ServicesDependedOn = new string[] { "DependingOnThisService" };
this.Installers.Add(si);

Everything works fine. My Problem right now is, that I want to set this Dependency only in fact of a special "flag" in the app.config - file.
But I am not able to read from the app.config - file in the ( from System.Configuration.Install.Installer inherited) class.

I neither get an exception nor a result from the config - file (always get an empty string).
So is there a possibility to read from the app.config in this class or, if not, what is the best alternative to do this?

Hope anybody can help me!
tia