Mono Class Library: System.Reflection.Assembly Overview | Members

System.Reflection.Assembly.CodeBase Property

Get the absolute path from which the assembly was originally loaded. [Edit]

public virtual string CodeBase { get; }

Value

Absolute path from which the assembly was originally loaded. [Edit]

Remarks

The Assembly.CodeBase of an assembly differs from the Assembly.Location in that the CodeBase is the original location of the assembly, while the Location tells the location of the loaded assembly. These paths will differ if, for example, the assembly was shadow copied before loading.

This example demonstrates the use of the CodeBase Property

C# Example
using System;
using System.Reflection;

class ReflectionTest
{
	public static void Main(string[] args){
		Assembly a = Assembly.GetAssembly(typeof(string));
		Console.WriteLine("CodeBase: {0}\n",a.CodeBase);
	}
}
  

Prints

CodeBase: file:///usr/local/lib/mono/1.0/mscorlib.dll

[Edit]

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0