InstallException Oluşturucular

Tanım

InstallException sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

InstallException()

InstallException sınıfının yeni bir örneğini başlatır.

InstallException(String)

sınıfının yeni bir örneğini InstallException başlatır ve kullanıcıya görüntülenecek iletiyi belirtir.

InstallException(SerializationInfo, StreamingContext)

InstallException sınıfının yeni bir örneğini serileştirilmiş verilerle başlatır.

InstallException(String, Exception)

sınıfının yeni bir örneğini InstallException başlatır ve kullanıcıya görüntülenecek iletiyi ve bu özel durumun nedeni olan iç özel duruma başvuruyu belirtir.

InstallException()

InstallException sınıfının yeni bir örneğini başlatır.

public:
 InstallException();
public InstallException ();
Public Sub New ()

Örnekler

Aşağıdaki örnekte oluşturucu gösterilmektedir InstallException . Sınıf örneğinin InstallException bir parçasıdır.

Bu örnekte Installutil.exe yöntemini çağırır Commit . içindeki Commit kod, derlemenin yüklenmesinden önce adlı FileDoesNotExist.txt bir dosyanın işlenmeden önce mevcut olduğunu varsar. Dosya FileDoesNotExist.txt yoksa, Commit bir InstallExceptionoluşturur.

Not

Bu örnekte, oluşturucunun aşırı yüklenmiş sürümlerinden birinin nasıl kullanılacağı gösterilmektedir InstallException . Kullanılabilir diğer örnekler için tek tek aşırı yükleme konulara bakın.

virtual void Commit( IDictionary^ savedState ) override
{
   Installer::Commit( savedState );
   Console::WriteLine( "Commit ..." );
   
   // Throw an error if a particular file doesn't exist.
   if (  !File::Exists( "FileDoesNotExist.txt" ) )
         throw gcnew InstallException;

   
   // Perform the final installation if the file exists.
}
public override void Commit(IDictionary savedState)
{
   base.Commit(savedState);
   Console.WriteLine("Commit ...");
   // Throw an error if a particular file doesn't exist.
   if(!File.Exists("FileDoesNotExist.txt"))
      throw new InstallException();
   // Perform the final installation if the file exists.
}
Public Overrides Sub Commit(savedState As IDictionary)
   MyBase.Commit(savedState)
   Console.WriteLine("Commit ...")
   ' Throw an error if a particular file doesn't exist.
   If Not File.Exists("FileDoesNotExist.txt") Then
      Throw New InstallException()
   End If
   ' Perform the final installation if the file exists.
End Sub

Şunlara uygulanır

InstallException(String)

sınıfının yeni bir örneğini InstallException başlatır ve kullanıcıya görüntülenecek iletiyi belirtir.

public:
 InstallException(System::String ^ message);
public InstallException (string message);
new System.Configuration.Install.InstallException : string -> System.Configuration.Install.InstallException
Public Sub New (message As String)

Parametreler

message
String

Kullanıcıya görüntülenecek ileti.

Örnekler

Aşağıdaki örnekte oluşturucu gösterilmektedir InstallException . Sınıf örneğinin InstallException bir parçasıdır.

Bu örnekte Installutil.exe yöntemini çağırır Uninstall . Kaldırma işlemi yalnızca adlı FileDoesNotExist.txt bir dosya varsa gerçekleşir. Aksi takdirde bir InstallExceptionoluşturur.

Not

Bu örnekte, oluşturucunun aşırı yüklenmiş sürümlerinden birinin nasıl kullanılacağı gösterilmektedir InstallException . Kullanılabilir diğer örnekler için tek tek aşırı yükleme konulara bakın.

virtual void Uninstall( IDictionary^ savedState ) override
{
   Installer::Uninstall( savedState );
   Console::WriteLine( "UnInstall ..." );
   
   // Throw an error if a particular file doesn't exist.
   if (  !File::Exists( "FileDoesNotExist.txt" ) )
         throw gcnew InstallException( "The file 'FileDoesNotExist'  does not exist" );

   
   // Perform the uninstall activites if the file exists.
}
public override void Uninstall(IDictionary savedState)
{
   base.Uninstall(savedState);
   Console.WriteLine("UnInstall ...");
   // Throw an error if a particular file doesn't exist.
   if(!File.Exists("FileDoesNotExist.txt"))
      throw new InstallException("The file 'FileDoesNotExist'" +
         " does not exist");
   // Perform the uninstall activites if the file exists.
}
Public Overrides Sub Uninstall(savedState As IDictionary)
   MyBase.Uninstall(savedState)
   Console.WriteLine("UnInstall ...")
   ' Throw an error if a particular file doesn't exist.
   If Not File.Exists("FileDoesNotExist.txt") Then
      Throw New InstallException("The file 'FileDoesNotExist'" + " does not exist")
   End If
   ' Perform the uninstall activites if the file exists.
End Sub

Şunlara uygulanır

InstallException(SerializationInfo, StreamingContext)

InstallException sınıfının yeni bir örneğini serileştirilmiş verilerle başlatır.

protected:
 InstallException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected InstallException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Configuration.Install.InstallException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Configuration.Install.InstallException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parametreler

info
SerializationInfo

Oluşturulan özel durumla ilgili serileştirilmiş nesne verilerini içeren SerializationInfo.

context
StreamingContext

Kaynak veya hedefle ilgili bağlamsal bilgileri içeren StreamingContext.

Şunlara uygulanır

InstallException(String, Exception)

sınıfının yeni bir örneğini InstallException başlatır ve kullanıcıya görüntülenecek iletiyi ve bu özel durumun nedeni olan iç özel duruma başvuruyu belirtir.

public:
 InstallException(System::String ^ message, Exception ^ innerException);
public InstallException (string message, Exception innerException);
new System.Configuration.Install.InstallException : string * Exception -> System.Configuration.Install.InstallException
Public Sub New (message As String, innerException As Exception)

Parametreler

message
String

Kullanıcıya görüntülenecek ileti.

innerException
Exception

Geçerli özel durumun nedeni olan özel durum. innerException parametresi değilsenull, geçerli özel durum iç özel durumu işleyen bir catch blokta oluşturulur.

Şunlara uygulanır