I have 3 application (asp.net website, console application, SSIS) and a common class library which is used by all these 3 application. That common library fetch the external configuration file which is located in the the current running directory. For example
ASP.NET - > c:\MySite\appconfig.xml
CONSOLE -> C:\MyConsoleApplication\appconfig.xml
SSIS -> c:\MySSISPakage\appconfig.xml
I used the following code to fetch the current running application path to fetch the appconfig.xml file
string appPath = AppDomain.CurrentDomain.BaseDirectory;
In the web application it is running file and returning the path
c:\MySite.
But in the console application it is return the path
C:\MyConsoleApplication\bin\debug
. I need to fetch the path
C:\MyConsoleApplication
for the console application. Any idea?