Zayko in the Net

Personal blog of Vitaly Zayko

NAVIGATION - SEARCH

How to get path to running Assembly? (C#)

In this post I explained how to find this directory in .NET Compact Framework. Here is how to do this in desktop Applications.

If you are working on a Windows Forms App you, can make this call:

System.IO.Path.GetDirectoryName(Application.ExecutablePath);

In non-WinForms Apps use this:

System.IO.Path.GetDirectoryName(
System.Reflection.
Assembly.GetEntryAssembly().Location);

Note that last back slash is not included.

Add comment