I use
string path = AppDomain.CurrentDomain.BaseDirectory;to get my path to the application, but it gives something like
string path = AppDomain.CurrentDomain.BaseDirectory;
C:\Projects\XYZ\ABC\bin\Debug
I do not want bin \ Debug. Is there any way to achieve this?
The AppDomain.CurrentDomain.BaseDirectory property gets the base directory that the assembly recognizer uses to build assemblies.
Thus, it works 100%, as it should be. If you want to create an application, cut it out and paste it to another location in another folder or drive. These changes will be reflected in this property.
In addition, you mentioned that you do not need this part bin\Debug, so you want to do this? Please be specific.
bin\Debug
( ):
string path = Application.ExecutablePath;
IDE , . IDE - , .
: , IDE , $PROJECT_DIR\bin\Debug.
string LPath; string Location = AppDomain.CurrentDomain.BaseDirectory + "Reports\\rptEmployInfoStat.rpt"; int index; index = Location.IndexOf("bin"); if (index > 0) { LPath = Location.Remove(index, 10); } else { LPath = Location; } rd.Load(@LPath);
, , , :
string dir = System.IO.Directory.GetCurrentDirectory().Replace("\\bin\\Debug", "");