InstallContext.Parameters プロパティとは何? わかりやすく解説 Weblio辞書 (original) (raw)
InstallUtil.exe の実行時に入力されたコマンド ライン パラメータを取得します。
名前空間: System.Configuration.Install
アセンブリ: System.Configuration.Install (system.configuration.install.dll 内)
構文
Public ReadOnly Property Parameters As StringDictionary
Dim instance As InstallContext Dim value As StringDictionary
value = instance.Parameters
public StringDictionary Parameters { get; }
public: property StringDictionary^ Parameters { StringDictionary^ get (); }
/** @property */ public StringDictionary get_Parameters ()
public function get Parameters () : StringDictionary
プロパティ値
インストール実行可能ファイルの実行時に入力されたコマンド ライン パラメータを表す StringDictionary。
新しい InstallContext が作成されるときに、コマンド ライン パラメータを解析した結果が Parameters プロパティに格納されます。パラメータのキーと値は両方とも文字列です。
この例は、InstallContext クラスの概要で紹介されているクラスの例からの抜粋です。
Parameters プロパティを取得して、ユーザーがコマンド ライン引数を入力したかどうかを確認するサンプルを次に示します。このサンプルでは、LogtoConsole パラメータが設定されているかどうかを確認するために、IsParameterTrue メソッドも使用します。yes の場合、これは LogMessage メソッドを使用してステータス メッセージをインストール ログ ファイルとコンソールに書き込みます。
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
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" ); } }
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" ); } }
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"); } }
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.0、1.1、1.0
関連項目
InstallContext クラス
InstallContext メンバ
System.Configuration.Install 名前空間
StringDictionary