InstallContext コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
InstallContext クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| InstallContext() |
InstallContext クラスの新しいインスタンスを初期化します。 |
| InstallContext(String, String[]) |
InstallContext クラスの新しいインスタンスを初期化し、インストール用のログ ファイルを作成します。 |
InstallContext()
InstallContext クラスの新しいインスタンスを初期化します。
public:
InstallContext();
public InstallContext();
Public Sub New ()
例
注
この例では、 InstallContext コンストラクターのオーバーロードされたバージョンの 1 つを使用する方法を示します。 使用可能なその他の例については、個々のオーバーロードに関するトピックを参照してください。
引数を指定せずにプログラムを呼び出すと、空の InstallContext が作成されます。
// There are no command line arguments, create an empty 'InstallContext'.
myInstallObject->myInstallContext = gcnew InstallContext;
// There are no command line arguments, create an empty 'InstallContext'.
myInstallObject.myInstallContext = new InstallContext();
' There are no command line arguments, create an empty 'InstallContext'.
myInstallObject.myInstallContext = New InstallContext()
注釈
このオーバーロードでは、インストール用のログ ファイルは作成されません。
適用対象
InstallContext(String, String[])
InstallContext クラスの新しいインスタンスを初期化し、インストール用のログ ファイルを作成します。
public:
InstallContext(System::String ^ logFilePath, cli::array <System::String ^> ^ commandLine);
public InstallContext(string logFilePath, string[] commandLine);
new System.Configuration.Install.InstallContext : string * string[] -> System.Configuration.Install.InstallContext
Public Sub New (logFilePath As String, commandLine As String())
パラメーター
- logFilePath
- String
このインストールのログ ファイルへのパス。ログ ファイルを作成する必要がない場合は null 。
- commandLine
- String[]
インストール・プログラムの実行時に入力されたコマンド・ライン・パラメーター、または何も入力されていない場合は null 。
例
この例は、 InstallContext クラスのクラス概要の例の抜粋です。
"/LogFile" と "/LogtoConsole" を指定すると、それぞれの引数をInstallContextに渡すことによってInstallContextが作成されます。
// Create an InstallContext object with the given parameters.
array<String^>^commandLine = gcnew array<String^>(args->Length - 1);
for ( int i = 0; i < args->Length - 1; i++ )
{
commandLine[ i ] = args[ i + 1 ];
}
myInstallObject->myInstallContext = gcnew InstallContext( args[ 1 ],commandLine );
// Create an InstallContext object with the given parameters.
String[] commandLine = new string[ args.Length ];
for( int i = 0; i < args.Length; i++ )
{
commandLine[ i ] = args[ i ];
}
myInstallObject.myInstallContext = new InstallContext( args[ 0 ], commandLine);
' Create an InstallContext object with the given parameters.
Dim commandLine() As String = New String(args.Length - 2) {}
Dim i As Integer
For i = 1 To args.Length - 1
commandLine(i-1) = args(i)
Next i
myInstallObject.myInstallContext = _
New InstallContext("/LogFile:example.log", commandLine)
注釈
インストールでInstallutil.exe (インストーラー ツール) を使用する場合、このコンストラクターは指定したパスにログ ファイルを作成し、コマンド ライン パラメーターの配列を解析して Parameters プロパティに格納します。 コマンド ライン パラメーターでログ ファイル パスが指定されている場合は、ファイルの作成に使用されます。 コマンド ラインでログ ファイル引数が指定されていない場合は、 logFilePath パラメーターの値が使用されます。 ログ ファイルの作成を抑制するには、"/logfile= " コマンド ライン パラメーターを渡します。
注意 (呼び出し元)
このコンストラクターを呼び出すときに、 logFilePath パラメーターに既定のログ ファイル パスを渡します。 これは、インストール実行可能ファイルの実行時に /logfile コマンド ライン パラメーターが使用されない限り、ログ ファイルが作成される場所です。