get the path of the project in C# [closed]
how do I get the path of the project? i want to assign a string with the path of the folder of the project. lets say, the folder of my project (in C#) is E:\projects\something (in folder something, I have the .sln file and all the source codes and also a folder pictures, and in some function I want to assign a string to the path of the project's folder for after it use fhe files in pictures... what I need is a function retorning the path of the project. string s=project_path;
private void button1_Click(object sender, System.EventArgs e)
{
string path;
path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
MessageBox.Show( path );
}
精彩评论