How to get the Base Directory of an application?

How to get the Base Directory of an application?

  • Comments 1

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

Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post