AssemblyName.GetAssemblyName(String) 메서드

정의

AssemblyName 지정된 파일에 대한 값을 가져옵니다.

public:
 static System::Reflection::AssemblyName ^ GetAssemblyName(System::String ^ assemblyFile);
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyFile);
static member GetAssemblyName : string -> System.Reflection.AssemblyName
Public Shared Function GetAssemblyName (assemblyFile As String) As AssemblyName

매개 변수

assemblyFile
String

반환할 어셈블리 AssemblyName 의 경로입니다.

반품

지정된 어셈블리 파일을 나타내는 개체입니다.

예외

assemblyFilenull입니다.

assemblyFile 가 잘못된 문화권을 가진 어셈블리와 같이 유효하지 않습니다.

assemblyFile 찾을 수 없습니다.

호출자에게 경로 검색 권한이 없습니다.

assemblyFile 가 유효한 어셈블리가 아닌 경우

어셈블리 또는 모듈이 두 개의 서로 다른 증명 정보 집합으로 두 번 로드되었습니다.

예제

다음 예제에서는 디스크의 AssemblyName 어셈블리에 대한 값을 가져옵니다. "MyAssembly.exe" 문자열을 하드 디스크의 어셈블리 파일 이름(필요한 경우 경로 포함)으로 대체하지 않으면 실행되지 않습니다. 또는 이 예제를 "MyAssembly.exe"로 컴파일할 수 있습니다.


using System;
using System.Reflection;

public class AssemblyName_GetAssemblyName
{
   public static void Main()
   {
      // Replace the string "MyAssembly.exe" with the name of an assembly,
      // including a path if necessary. If you do not have another assembly
      // to use, you can use whatever name you give to this assembly.
      //
      AssemblyName myAssemblyName = AssemblyName.GetAssemblyName("MyAssembly.exe");
      Console.WriteLine("\nDisplaying assembly information:\n");
      Console.WriteLine(myAssemblyName.ToString());
   }
}
Imports System.Reflection

Public Class AssemblyName_GetAssemblyName
   
   Public Shared Sub Main()
      
      ' Replace the string "MyAssembly.exe" with the name of an assembly,
      ' including a path if necessary. If you do not have another assembly
      ' to use, you can use whatever name you give to this assembly.
      '
      Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName("MyAssembly.exe")
      Console.WriteLine(vbCrLf & "Displaying assembly information:" & vbCrLf)
      Console.WriteLine(myAssemblyName.ToString())
   End Sub
End Class

설명

파일에 어셈블리 매니페스트가 포함된 경우에만 작동합니다. 이 메서드를 사용하면 파일을 열고 닫을 수 있지만 어셈블리는 이 도메인에 추가되지 않습니다.

적용 대상