Assembly.Location 속성

정의

매니페스트가 포함된 로드된 파일의 전체 경로나 UNC 위치를 가져옵니다.Gets the full path or UNC location of the loaded file that contains the manifest.

public:
 virtual property System::String ^ Location { System::String ^ get(); };
public virtual string Location { get; }
member this.Location : string
Public Overridable ReadOnly Property Location As String

속성 값

String

매니페스트가 포함된 로드된 파일의 위치입니다.The location of the loaded file that contains the manifest. 를 사용 하는 경우와 같이 바이트 배열에서 어셈블리를 로드 하는 경우 반환 되는 Load(Byte[]) 값은 빈 문자열 ("")입니다.If the assembly is loaded from a byte array, such as when using Load(Byte[]), the value returned is an empty string ("").

구현

예외

현재 어셈블리가 AssemblyBuilder 개체로 표현되는 동적 어셈블리입니다.The current assembly is a dynamic assembly, represented by an AssemblyBuilder object.

예제

다음 예제에서는 매니페스트가 포함 된 로드 된 파일의 위치를 표시 합니다.The following example displays the location of the loaded file that contains the manifest.

Assembly^ SampleAssembly;
// Instantiate a target object.
Int32 Integer1(0);
Type^ Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
// Display the physical location of the assembly containing the manifest.
Console::WriteLine( "Location= {0}", SampleAssembly->Location );
// The example displays the following output:
//    Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll  
Assembly SampleAssembly;
// Instantiate a target object.
Int32 Integer1 = new Int32();
Type Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.
SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
// Display the physical location of the assembly containing the manifest.
Console.WriteLine("Location=" + SampleAssembly.Location);
// The example displays the following output:
//   Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
Dim SampleAssembly As [Assembly]
' Instantiate a target object.
Dim Integer1 As New Int32()
Dim Type1 As Type
' Set the Type instance to the target class type.
Type1 = Integer1.GetType()
' Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = [Assembly].GetAssembly(Integer1.GetType())
' Display the physical location of the assembly containing the manifest.
Console.WriteLine(("Location=" + SampleAssembly.Location))
' The example displays the following output:
'    Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll

설명

.NET 5.0 이상 버전에서 번들 어셈블리의 경우 반환 되는 값은 빈 문자열입니다.In .NET 5.0 and later versions, for bundled assemblies, the value returned is an empty string.

.NET Framework에만 해당: 로드 된 파일이 섀도 복사된 경우 위치는 해당 파일이 섀도 복사 된 후의 위치입니다..NET Framework only: If the loaded file was shadow-copied, the location is that of the file after being shadow-copied. 파일이 섀도 복사 되기 전의 위치를 가져오려면 속성을 사용 합니다 CodeBase .To get the location before the file has been shadow-copied, use the CodeBase property.

적용 대상