AssemblyInstaller.CheckIfInstallable(String) 메서드

정의

지정된 어셈블리를 설치할 수 있는지 확인합니다.

public:
 static void CheckIfInstallable(System::String ^ assemblyName);
public static void CheckIfInstallable (string assemblyName);
static member CheckIfInstallable : string -> unit
Public Shared Sub CheckIfInstallable (assemblyName As String)

매개 변수

assemblyName
String

설치 관리자를 검색할 어셈블리입니다.

예외

지정된 어셈블리를 설치할 수 없는 경우

예제

다음 예제에서는 메서드가 CheckIfInstallable 기존 어셈블리와 존재하지 않는 어셈블리 모두에 적용되고 호출 결과가 콘솔에 표시됩니다.

#using <System.dll>
#using <System.Configuration.Install.dll>

using namespace System;
using namespace System::Configuration::Install;
int main()
{
   try
   {
      
      // Determine whether the assembly 'MyAssembly' is installable.
      AssemblyInstaller::CheckIfInstallable( "MyAssembly_CheckIfInstallable.exe" );
      Console::WriteLine( "The assembly 'MyAssembly_CheckIfInstallable' is installable" );
      
      // Determine whether the assembly 'NonExistant' is installable.
      AssemblyInstaller::CheckIfInstallable( "NonExistant" );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e );
   }

}
using System;
using System.Configuration.Install;

class MyCheckIfInstallableClass:Installer
{
   static void Main()
   {

      try
      {
         // Determine whether the assembly 'MyAssembly' is installable.
         AssemblyInstaller.CheckIfInstallable( "MyAssembly_CheckIfInstallable.exe" );

         Console.WriteLine( "The assembly 'MyAssembly_CheckIfInstallable' is installable" );

         // Determine whether the assembly 'NonExistant' is installable.
         AssemblyInstaller.CheckIfInstallable( "NonExistant" );
      }
      catch( Exception )
      {
      }
   }
}
Imports System.Configuration.Install

Class MyCheckIfInstallableClass
   
   Shared Sub Main()

      Try
         ' Determine whether the assembly 'MyAssembly' is installable.
         AssemblyInstaller.CheckIfInstallable("MyAssembly_CheckIfInstallable.exe")
         
         Console.WriteLine("The assembly 'MyAssembly_CheckIfInstallable' is installable")
         
         ' Determine whether the assembly 'NonExistant' is installable.
         AssemblyInstaller.CheckIfInstallable("NonExistant")
       Catch 
      End Try

   End Sub

End Class

설명

메서드는 CheckIfInstallable 지정된 어셈블리를 설치할 수 있는지 여부를 결정합니다. 예외가 throw되지 않도록 하려면 파일이 다음 조건을 충족해야 합니다.

  • 파일이 존재합니다.

  • 파일은 .NET Framework 어셈블리입니다.

  • 공용 형식은 파일에서 읽을 수 있습니다.

  • 클래스를 확장하고 Installer 특성을 포함하는 하나 이상의 공용 비 추상 클래스가 Yes 있습니다.

  • 각 설치 관리자의 instance 만들 수 있습니다.

참고

어셈블리가 유효하지만 설치 관리자가 없는 경우 예외가 throw됩니다. 이 동작은 설치 시 빈 어셈블리를 설치하는 데 오류가 없는 경우와 다릅니다.

적용 대상