directories under c# and .net

stian farstad

stian farstad

Mar 5 2010 2:15 PM

I'm a c++ programmer having my first looks at c# and the .net framework.

I don't quite get the directory structure in c#/net. In c++ you just put your data in your project directory, 
the compiler creates directories for your platforms/build where it puts all the obj/exe/dll/exe files when you compile.
They all get placed acordingly to what platform you are compiling for. When you run the project for the selected 
platform, the exe file is run as if is was located in the projects basedirectory, indepent from whatever platform it is aimed at.

In C#/.net the project is relative to the target platform i.e. <project>/bin/x86/Debug/

This is very annoying, I'm sure I'm missing something here. It can't possibly be the meaning that one should need to 
copy all data into the directory of each .exe for each targeted build? Some files you want to be specific for a platform though...

Is there some nice way to achieve a program to set it's current path to the basepath, or look for folders there, 
without alot of ugly hardcoding(i.e. not anything like "../../../../Data/images/128/blah.png" ).

I'm sure I'm still missing the essentials here, any pointers / links would be greatly appreciated. :)


Answers (1)