Get the current version of the Assembly

January 10, 2008

The following code snippet return the Version number of currently executing assembly -

static string GetCurrentAssemblyVersionNumber()
        {
            Assembly currentAssembly = Assembly.GetExecutingAssembly(); 

            return currentAssembly.FullName.Split( new Char [] {','} )[1];
        }


Get Current Executing assembly’s Directory

December 17, 2007

Sometimes it becomes necessary to find out the folder where the current executing assembly is running. Using following code snippet, you can get it very easily –

string currentAssemblyDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);