views:

419

answers:

1

Hi,

I am working on a project in which I have many text and xml files. I read those from my program at runtime.

I have kept paths to those files in app.config file, but all the paths are absolute paths like "C:\my_project\help_files\rejectList.txt" .

If I keep only "\help_files\rejectList.txt" path, program throws filenotfound exception.

Can anyone please tell me how to set relative paths in C# applications? 

I would like to set something like "$root\help_files\rejectList.txt" and at runtime $root should resolve to actual path.

Is there any way in .net to set paths like this?

Also, I have one more question. I have some dll's also that are needed for my project. Where do people usually keep dll's? In same folder as that of the exe file or should we create one folder called "lib" and put dll's there?

Thanks and Regards, Shekhar

+1  A: 

answer 1:, check Path Class

answer2: keep your dll's in output directory of projects. debug / release

see below

Optimizing Visual Studio solution build - where to put DLL files?

Asad Butt
Thanks a lot !!!!
Shekhar
Shekhar