The path to the resource files in the VS2010 project

I am using VS 2010 and .NET 4.0.

I created a solution with one console C # project. I added several folders to the project through the context menu in the project> Add> New folder. Then I put some files there.

Now I want to get the path (or file descriptor) to one of these resources. Is there a good way to get my way?

NOTE 1. The project is in the original control, so I need a way that will work in different file paths.

NOTE 2. If possible, I do not want to use Directory.GetCurrentDirectory()and System.Reflection.Assembly.GetExecutingAssembly().Location.

EDIT:

I seem to need a direct answer to this Stackoverflow question . I want a project directory, without "bin \ Debug"

+1
source share
1 answer

From MSDN :

string path = System.IO.Path.GetDirectoryName( 
  System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );

Also check out this answer on Stackoverflow.

+1
source

All Articles