Saturday, June 7, 2008

Windows Service:
Path to Executable

Working on a Windows Service, trying to get the path to the executable which is displayed in the properties of the service as "Path to executable:"

using System.IO

string pathToExecutable = System.Reflection.Assembly.GetExecutingAssembly().Location;
FileInfo fileInfo = new FileInfo(pathToExecutable);
string pathToConfig = fileInfo.DirectoryName + @"\Configuration.xml";

No comments:

Check This Out!

More Links to Good Information