Sunday, July 17, 2011

How do I find the install directory of a Windows Service, using C#?

You can use reflection to get the location of the executing assembly.
String path = System.Reflection.Assembly.GetExecutingAssembly().Location;
path = System.IO.Path.GetDirectoryName(path);
 
 

No comments: