How to get the Base Directory of an application?



Well, to be honest that’s actually quite easy, nevertheless I keep forgetting it all the time (pretty much like Error 15023: User already exists in current database). Seems like I enter an age where my short term memory is already gone but the long term memory hasn’t arrived yet 😉


So, without further frills, that’s how it works:






Dim myFile = String.Format(“{0}\myFile.xml”, _
                          AppDomain.CurrentDomain.BaseDirectory)


Happy coding!


   Daniel