// find current application file path at runtime:
string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
// window service can not find file problem
// window service default path is "C:/WINDOWS/system32", or %WINDIR%/system32
//either put your file in default path or change the default path at the start of the service.
Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
// window service reference
1. add the app.config file from the program project to the service project, no need add to installer project. the installer will automatically add it and rename to *.service.exe.config.
2. manually add the reference used in program project into the installer reference. no need add to installer project. the installer will automatically add them in.
3. add the extra file from your program project to the service project (add exist file). after that, also need add the file from the service project to installer project (add file).
in the program, change the window service default path. (above).