Język

InstallException Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy InstallException.

Przeciążenia

Nazwa Opis
InstallException()

Inicjuje nowe wystąpienie klasy InstallException.

InstallException(String)

Inicjuje InstallException nowe wystąpienie klasy i określa komunikat do wyświetlenia użytkownikowi.

InstallException(SerializationInfo, StreamingContext)

Inicjuje InstallException nowe wystąpienie klasy z serializowanymi danymi.

InstallException(String, Exception)

Inicjuje nowe wystąpienie InstallException klasy i określa komunikat wyświetlany użytkownikowi oraz odwołanie do wyjątku wewnętrznego, który jest przyczyną tego wyjątku.

InstallException()

Inicjuje nowe wystąpienie klasy InstallException.

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

Przykłady

W poniższym przykładzie pokazano InstallException konstruktor. Jest to część przykładu InstallException klasy.

W tym przykładzie Installutil.exe wywołuje metodę Commit . W kodzie zakłada Commit się, że plik o nazwie FileDoesNotExist.txt istnieje przed instalacją zestawu może zostać zatwierdzony. Jeśli plik FileDoesNotExist.txt nie istnieje, Commit zgłasza element InstallException.

Note

W tym przykładzie pokazano, jak używać jednej z przeciążonych wersji konstruktora InstallException . Aby zapoznać się z innymi przykładami, które mogą być dostępne, zobacz poszczególne tematy przeciążenia.

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

Dotyczy

InstallException(String)

Inicjuje InstallException nowe wystąpienie klasy i określa komunikat do wyświetlenia użytkownikowi.

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)

Parametry

message
String

Komunikat wyświetlany użytkownikowi.

Przykłady

W poniższym przykładzie pokazano InstallException konstruktor. Jest to część przykładu InstallException klasy.

W tym przykładzie Installutil.exe wywołuje metodę Uninstall . Odinstalowanie będzie miało miejsce tylko wtedy, gdy plik o nazwie FileDoesNotExist.txt istnieje. W przeciwnym razie zgłasza element InstallException.

Note

W tym przykładzie pokazano, jak używać jednej z przeciążonych wersji konstruktora InstallException . Aby zapoznać się z innymi przykładami, które mogą być dostępne, zobacz poszczególne tematy przeciążenia.

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

Dotyczy

InstallException(SerializationInfo, StreamingContext)

Inicjuje InstallException nowe wystąpienie klasy z serializowanymi danymi.

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)

Parametry

info
SerializationInfo

SerializationInfo przechowujące zserializowane dane obiektu dotyczące zgłaszanego wyjątku.

context
StreamingContext

StreamingContext zawierający kontekstowe informacje o źródle lub miejscu docelowym.

Dotyczy

InstallException(String, Exception)

Inicjuje nowe wystąpienie InstallException klasy i określa komunikat wyświetlany użytkownikowi oraz odwołanie do wyjątku wewnętrznego, który jest przyczyną tego wyjątku.

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)

Parametry

message
String

Komunikat wyświetlany użytkownikowi.

innerException
Exception

Wyjątek, który jest przyczyną bieżącego wyjątku. Jeśli parametr innerException nie jest null, bieżący wyjątek jest zgłaszany w bloku catch, który obsługuje wyjątek wewnętrzny.

Dotyczy