Assembly::CodeBase Property
.NET Framework (current version)
Gets the location of the assembly as specified originally, for example, in an AssemblyName object.
Assembly: mscorlib (in mscorlib.dll)
Implements
_Assembly::CodeBaseTo get the absolute path to the loaded manifest-containing file, use the Assembly::Location property instead.
If the assembly was loaded as a byte array, using an overload of the Load method that takes an array of bytes, this property returns the location of the caller of the method, not the location of the loaded assembly.
The following example uses the CodeBase property.
using namespace System; using namespace System::Reflection; void main() { // Instantiate a target object. int integer1 = 1632; // Instantiate an Assembly class to the assembly housing the Integer type. Assembly^ systemAssembly = integer1.GetType()->Assembly; // Get the location of the assembly using the file: protocol. Console::WriteLine("CodeBase = {0}", systemAssembly->CodeBase); } // The example displays output like the following: // CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
FileIOPermission
for access to the path. Associated enumeration: FileIOPermissionAccess::PathDiscovery
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Available since 1.1
Silverlight
Available since 2.0
Show: