InstallContext.Parameters Eigenschaft

Definition

Ruft die Befehlszeilenparameter ab, die beim Ausführen von InstallUtil.exe eingegeben wurden.

public:
 property System::Collections::Specialized::StringDictionary ^ Parameters { System::Collections::Specialized::StringDictionary ^ get(); };
public System.Collections.Specialized.StringDictionary Parameters { get; }
member this.Parameters : System.Collections.Specialized.StringDictionary
Public ReadOnly Property Parameters As StringDictionary

Eigenschaftswert

Ein StringDictionary, das die Befehlszeilenparameter darstellt, die beim Ausführen der Installationsdatei eingegeben wurden.

Beispiele

Dieses Beispiel ist ein Auszug des Beispiels in der Klassenübersicht der InstallContext -Klasse.

Im Beispiel wird die Parameters -Eigenschaft abgerufen, um festzustellen, ob ein Befehlszeilenargument vom Benutzer eingegeben wurde. Außerdem wird die IsParameterTrue -Methode verwendet, um festzustellen, ob der LogtoConsole Parameter festgelegt wurde. Wenn yes, wird die -Methode verwendetLogMessage, um status Nachrichten in die Installationsprotokolldatei und die Konsole zu schreiben.

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.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" );
   }
}
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

Hinweise

Wenn ein neues InstallContext erstellt wird, werden die Befehlszeilenparameter in die Parameters -Eigenschaft analysiert. Sowohl die Schlüssel als auch die Werte der Parameter sind Zeichenfolgen.

Gilt für:

Weitere Informationen