InstallContext.Parameters プロパティとは何? わかりやすく解説 Weblio辞書 (original) (raw)

InstallUtil.exe の実行時入力されコマンド ライン パラメータ取得します

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

Visual Basic (宣言)

Public ReadOnly Property Parameters As StringDictionary

Visual Basic (使用法)

Dim instance As InstallContext Dim value As StringDictionary

value = instance.Parameters

C#

public StringDictionary Parameters { get; }

C++

public: property StringDictionary^ Parameters { StringDictionary^ get (); }

J#

/** @property */ public StringDictionary get_Parameters ()

JScript

public function get Parameters () : StringDictionary

プロパティ
インストール実行可能ファイル実行時入力されコマンド ライン パラメータを表す StringDictionary。

解説解説

新しい InstallContext が作成されるときに、コマンド ライン パラメータ解析した結果Parameters プロパティ格納されます。パラメータキーと値は両方とも文字列です。

使用例使用例

この例は、InstallContext クラス概要紹介されているクラスの例からの抜粋です。

Parameters プロパティ取得してユーザーコマンド ライン引数入力したかどうか確認するサンプル次に示します。このサンプルでは、LogtoConsole パラメータ設定されているかどうか確認するために、IsParameterTrue メソッド使用しますyes場合、これは LogMessage メソッド使用してステータス メッセージインストール ログ ファイルコンソール書き込みます

Visual Basic

Dim myStringDictionary As StringDictionary = myInstallContext.Parameters If myStringDictionary.Count = 0 Then Console.WriteLine("No parameters have been entered in the command line" + _ "hence, the install will take place in the silent mode") Else ' Check wether the "LogtoConsole" parameter has been set. If myInstallContext.IsParameterTrue("LogtoConsole") = True Then ' Display the message to the console and add it to the logfile. myInstallContext.LogMessage("The 'Install' method has been called") End If End If

C#

StringDictionary myStringDictionary = myInstallContext.Parameters; if( myStringDictionary.Count == 0 ) { Console.WriteLine( "No parameters have been entered in the command line " +"hence, the install will take place in the silent mode" ); } else { // Check whether the "LogtoConsole" parameter has been set. if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true ) { // Display the message to the console and add it to the logfile. myInstallContext.LogMessage( "The 'Install' method has been called" ); } }

C++

StringDictionary^ myStringDictionary = myInstallContext->Parameters; if ( myStringDictionary->Count == 0 ) { Console::Write( "No parameters have been entered in the command line " ); Console::WriteLine( "hence, the install will take place in the silent mode" ); } else { // Check whether the "LogtoConsole" parameter has been set. if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) { // Display the message to the console and add it to the logfile. myInstallContext->LogMessage( "The 'Install' method has been called" ); } }

J#

StringDictionary myStringDictionary = myInstallContext.get_Parameters(); if (myStringDictionary.get_Count() == 0) { Console.WriteLine("No parameters have been entered in the command " +"line hence, the install will take place in the silent mode"); } else { // Check whether the "LogtoConsole" parameter has been set. if (myInstallContext.IsParameterTrue("LogtoConsole") == true) { // Display the message to the console and add it //to the logfile. myInstallContext.LogMessage( "The 'Install' method has been called"); } }

.NET Framework のセキュリティ.NET Frameworkセキュリティ

プラットフォームプラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォーム中には.NET Framework によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

.NET Framework
サポート対象 : 2.01.11.0

参照参照

関連項目
InstallContext クラス
InstallContext メンバ
System.Configuration.Install 名前空間
StringDictionary