Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a small doubt. I want to get my configue file path from folder where i install my project it may be any drive path. currently i give path hardcoded in program but at time of installation in different system it would give error.

I tried following ,

string f = Path.Combine(Directory.GetCurrentDirectory(), "hr.ini");

but after installing service it returns path like below,

"C:\Windows\system32\hr.ini. "

but i want its actual path where this file is present which is "C:\ProgramFiles\SetupProject\hr.ini".

so please suggest me any examples.
thanks
Posted

1 solution

You can use the AppDomain path, like so:

C#
var f = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "hr.ini");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900