InstallExceptionとは? わかりやすく解説

InstallException クラス

インストールコミットロールバック、またはアンインストールの各フェーズエラー発生したときにスローされる例外

名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文構文

<SerializableAttribute> _
Public Class InstallException
    Inherits SystemException
Dim instance As InstallException
[SerializableAttribute] 
public class InstallException : SystemException
[SerializableAttribute] 
public ref class InstallException : public
 SystemException
/** @attribute SerializableAttribute() */ 
public class InstallException extends SystemException
SerializableAttribute 
public class InstallException extends
 SystemException
使用例使用例

InstallException コンストラクタの例と共に、独自のインストーラを持つアセンブリ表示する例を次に示しますインストーラMyInstaller という名前で、属性 RunInstallerAttribute持っており、このインストーラインストーラ ツール (Installutil.exe) によって起動されることを示してます。インストーラ ツール (Installutil.exe) は、CommitRollbackInstall、および Uninstall の各メソッド呼び出します。Commitコードは、アセンブリインストールコミットされる前にFileDoesNotExist.txt という名前のファイル存在する仮定してます。ファイル FileDoesNotExist.txt存在しない場合Commit は、InstallException発生させます。同じことは、FileDoesNotExist.txt という名前のファイル存在する場合にだけアンインストールが行われる Uninstall にも当てはまりますそれ以外場合は、InstallException発生しますRollbackコード片が実行されます。このコード片の実行は、例外発生させる可能性あります例外発生した場合、その例外キャッチされ、渡される例外使用して InstallException発生させます

メモメモ

この例は Installutil.exe を使用して実行しますコマンド プロンプト次のように入力します

Installutil InstallException.exe

または

Installutil /u InstallException.exe

Imports System
Imports System.ComponentModel
Imports System.Collections
Imports System.Configuration.Install
Imports System.IO

<RunInstaller(True)> Public Class
 MyInstaller
   Inherits Installer

   Public Overrides Sub
 Install(savedState As IDictionary)
      MyBase.Install(savedState)
      Console.WriteLine("Install ...")

     ' Commit is called when install goes through successfully.
     ' Rollback is called if there is any error during Install.
     ' Uncommenting the code below will lead to 'RollBack' being called
,
     ' currently 'Commit' shall be called.
     ' throw new IOException();

   End Sub

   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

   Public Overrides Sub
 Rollback(savedState As IDictionary)
      MyBase.Rollback(savedState)
      Console.WriteLine("RollBack ...")
      Try
         ' Performing some activity during rollback that raises an 'IOException'.
         Throw New IOException()
      Catch e As Exception
         Throw New InstallException("IOException
 raised", e)
      End Try
   End Sub 'Rollback
    ' Perform the remaining rollback activites if no exception raised.

   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

End Class

' An Assembly that has its own installer.
Public Class MyAssembly1
   Public Shared Sub Main()
      Console.WriteLine("This assembly is just an example for
 the Installer")
   End Sub
End Class
using System;
using System.ComponentModel;
using System.Collections;
using System.Configuration.Install;
using System.IO;


[RunInstaller(true)]
public class MyInstaller : Installer
{
   public override void Install(IDictionary
 savedState)
   {
      base.Install(savedState);
      Console.WriteLine("Install ...");

      // Commit is called when install goes through successfully.
      // Rollback is called if there is any error during Install.

      // Uncommenting the code below will lead to 'RollBack' being called
,
      // currently 'Commit' shall be called.

      // throw new IOException();
   }

   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 override void Rollback(IDictionary
 savedState)
   {
      base.Rollback(savedState);
      Console.WriteLine("RollBack ...");
      try
      {
         // Performing some activity during rollback that raises an
 'IOException'.
         throw new IOException();
      }
      catch(Exception e)
      {
         throw new InstallException("IOException raised",
 e);
      }
      // Perform the remaining rollback activites if no exception raised.
   }

   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.
   }
}


// An Assembly that has its own installer.
public class MyAssembly1
{
   public static void Main()
   {
      Console.WriteLine("This assembly is just an example for
 the Installer");
   }
}
#using <System.dll>
#using <System.Configuration.Install.dll>

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Configuration::Install;
using namespace System::IO;

[RunInstaller(true)]
ref class MyInstaller: public Installer
{
public:
   virtual void Install( IDictionary^ savedState ) override
   {
      Installer::Install( savedState );
      Console::WriteLine( "Install ..." );
      
      // Commit is called when install goes through successfully.
      // Rollback is called if there is any error during Install.
      // Uncommenting the code below will lead to 'RollBack' being called
,
      // currently 'Commit' shall be called.
      // throw new IOException();
   }


   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.
   }


   virtual void Rollback( IDictionary^ savedState ) override
   {
      Installer::Rollback( savedState );
      Console::WriteLine( "RollBack ..." );
      try
      {
         
         // Performing some activity during rollback that raises an
 'IOException*'.
         throw gcnew IOException;
      }
      catch ( Exception^ e ) 
      {
         throw gcnew InstallException( "IOException* raised",e );
      }

      
      // Perform the remaining rollback activites if no exception raised.
   }


   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.
   }

};

int main()
{
   Console::WriteLine( "This assembly is just an example for
 the Installer" );
}

import System.*;
import System.ComponentModel.*;
import System.Collections.*;
import System.Configuration.Install.*;
import System.IO.*;

/** @attribute RunInstaller(true)
 */
public class MyInstaller extends Installer
{
    public void Install(IDictionary savedState)
    {
        super.Install(savedState);
        Console.WriteLine("Install ...");
    } //Install

    // Commit is called when install goes through successfully.
    // Rollback is called if there is any error during Install.
    // Uncommenting the code below will lead to 'RollBack' being called
,
    // currently 'Commit' shall be called.
    // throw new IOException();
    public void Commit(IDictionary savedState)
 
        throws System.Configuration.Install.InstallException   
    {
        super.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.
    } //Commit
    public void Rollback(IDictionary savedState)
 
        throws System.Configuration.Install.InstallException   
    {
        super.Rollback(savedState);
        Console.WriteLine("RollBack ...");
        try {
            // Performing some activity during rollback 
            //that raises an 'IOException'.
            throw new IOException();
        }
        catch (System.Exception e) {
            throw new InstallException("IOException raised",
 e);
        }
        // Perform the remaining rollback activites if no exception
 raised.
    } //Rollback
    public void Uninstall(IDictionary savedState)
 
        throws System.Configuration.Install.InstallException   
    {
        super.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");
        }
    } //Uninstall
} //MyInstaller
 // Perform the uninstall activites if the file exists.

// An Assembly that has its own installer.
public class MyAssembly1
{
    public static void main(String[]
 args)
    {
        Console.WriteLine("This assembly is just an example for
 the Installer");
    } //main
} //MyAssembly1
継承階層継承階層
System.Object
   System.Exception
     System.SystemException
      System.Configuration.Install.InstallException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

InstallException コンストラクタ ()

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

名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文構文

Dim instance As New InstallException
public InstallException ()
public:
InstallException ()
public InstallException ()
public function InstallException ()
使用例使用例

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

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

メモメモ

InstallException コンストラクタオーバーロードされたバージョンいずれか使用方法次の例に示しますその他の例については、個々オーバーロードトピック参照してください

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
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.
}
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 void Commit(IDictionary savedState)
 
    throws System.Configuration.Install.InstallException   
{
    super.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.
} //Commit
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
InstallException クラス
InstallException メンバ
System.Configuration.Install 名前空間

InstallException コンストラクタ (String)

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

名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文構文

使用例使用例

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

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

メモメモ

InstallException コンストラクタオーバーロードされたバージョンいずれか使用方法次の例に示しますその他の例については、個々オーバーロードトピック参照してください

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
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.
}
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 void Uninstall(IDictionary savedState)
 
    throws System.Configuration.Install.InstallException   
{
    super.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");
    }
} //Uninstall
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
InstallException クラス
InstallException メンバ
System.Configuration.Install 名前空間

InstallException コンストラクタ (SerializationInfo, StreamingContext)

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

名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文構文

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New InstallException(info,
 context)
protected InstallException (
    SerializationInfo info,
    StreamingContext context
)
protected:
InstallException (
    SerializationInfo^ info, 
    StreamingContext context
)
protected InstallException (
    SerializationInfo info, 
    StreamingContext context
)
protected function InstallException (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

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

context

転送元または転送先に関すコンテキスト情報含んでいる StreamingContext。

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
InstallException クラス
InstallException メンバ
System.Configuration.Install 名前空間

InstallException コンストラクタ (String, Exception)

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

名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文構文

Public Sub New ( _
    message As String, _
    innerException As Exception _
)
Dim message As String
Dim innerException As Exception

Dim instance As New InstallException(message,
 innerException)
public InstallException (
    string message,
    Exception innerException
)
public:
InstallException (
    String^ message, 
    Exception^ innerException
)
public InstallException (
    String message, 
    Exception innerException
)
public function InstallException (
    message : String, 
    innerException : Exception
)

パラメータ

message

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

innerException

現在の例外の原因である例外innerException パラメータnull 参照 (Visual Basic では Nothing) でない場合は、内部例外処理する catch ブロック現在の例外が発生します

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
InstallException クラス
InstallException メンバ
System.Configuration.Install 名前空間

InstallException コンストラクタ

InstallException クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
InstallException () InstallException クラス新しインスタンス初期化します。
InstallException (String) InstallException クラス新しインスタンス初期化しユーザー表示するメッセージ指定します
InstallException (SerializationInfo, StreamingContext) シリアル化したデータ使用してInstallException クラス新しインスタンス初期化します。
InstallException (String, Exception) InstallException クラス新しインスタンス初期化します。ユーザー表示するメッセージ、およびこの例外原因である内部例外への参照指定します
参照参照

関連項目

InstallException クラス
InstallException メンバ
System.Configuration.Install 名前空間

InstallException プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。 ( Exception から継承されます。)
参照参照

関連項目

InstallException クラス
System.Configuration.Install 名前空間
Commit
Installer クラス
Rollback
Uninstall

InstallException メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

InstallException クラス
System.Configuration.Install 名前空間
Commit
Installer クラス
Rollback
Uninstall

InstallException メンバ

インストールコミットロールバック、またはアンインストールの各フェーズエラー発生したときにスローされる例外

InstallException データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。(Exception から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

InstallException クラス
System.Configuration.Install 名前空間
Commit
Installer クラス
Rollback
Uninstall



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「InstallException」の関連用語

InstallExceptionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



InstallExceptionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS