InstallException コンストラクター

定義

InstallException クラスの新しいインスタンスを初期化します。

オーバーロード

InstallException()

InstallException クラスの新しいインスタンスを初期化します。

InstallException(String)

InstallException クラスの新しいインスタンスを初期化し、ユーザーに表示するメッセージを指定します。

InstallException(SerializationInfo, StreamingContext)

シリアル化したデータを使用して、InstallException クラスの新しいインスタンスを初期化します。

InstallException(String, Exception)

InstallException クラスの新しいインスタンスを初期化します。ユーザーに表示するメッセージ、およびこの例外の原因である内部例外への参照を指定します。

InstallException()

InstallException クラスの新しいインスタンスを初期化します。

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

次の例では、 コンストラクターを InstallException 示します。 これは、 クラスの例の InstallException 一部です。

この例では、 メソッド Installutil.exe 呼び出します Commit 。 の Commit コードは、アセンブリのインストールをコミットする前に、 という名前 FileDoesNotExist.txt のファイルが存在することを前提とします。 ファイル FileDoesNotExist.txt が存在しない場合は、 CommitInstallException発生させます。

注意

この例では、オーバーロードされたバージョンのコンストラクターの 1 つを使用する方法を InstallException 示します。 使用可能なその他の例については、個々のオーバーロードに関するトピックを参照してください。

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

適用対象

InstallException(String)

InstallException クラスの新しいインスタンスを初期化し、ユーザーに表示するメッセージを指定します。

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)

パラメーター

message
String

ユーザーに表示するメッセージ。

次の例では、 コンストラクターを InstallException 示します。 これは、 クラスの例の InstallException 一部です。

この例では、 メソッド Installutil.exe 呼び出します Uninstall 。 アンインストールは、 という名前 FileDoesNotExist.txt のファイルが存在する場合にのみ行われます。 それ以外の場合は、 が発生します InstallException

注意

この例では、オーバーロードされたバージョンのコンストラクターの 1 つを使用する方法を InstallException 示します。 使用可能なその他の例については、個々のオーバーロードに関するトピックを参照してください。

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

適用対象

InstallException(SerializationInfo, StreamingContext)

シリアル化したデータを使用して、InstallException クラスの新しいインスタンスを初期化します。

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)

パラメーター

info
SerializationInfo

スローされている例外に関するシリアル化済みオブジェクト データを保持している SerializationInfo

context
StreamingContext

転送元または転送先についてのコンテキスト情報を含む StreamingContext です。

適用対象

InstallException(String, Exception)

InstallException クラスの新しいインスタンスを初期化します。ユーザーに表示するメッセージ、およびこの例外の原因である内部例外への参照を指定します。

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)

パラメーター

message
String

ユーザーに表示するメッセージ。

innerException
Exception

現在の例外の原因となった例外。 innerException パラメーターが null でない場合は、内部例外を処理する catch ブロックで現在の例外が発生します。

適用対象