Share via


InstallContext.Parameters Proprietà

Definizione

Ottiene i parametri della riga di comando immessi al momento dell'esecuzione di InstallUtil.exe.

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

Valore della proprietà

StringDictionary che rappresenta i parametri della riga di comando immessi al momento dell'esecuzione del file eseguibile di installazione.

Esempio

Questo esempio è un estratto dell'esempio nella panoramica della classe della InstallContext classe.

L'esempio recupera la Parameters proprietà per verificare se un argomento della riga di comando è stato immesso dall'utente. Usa anche il IsParameterTrue metodo per scoprire se il LogtoConsole parametro è stato impostato. Se yes, userà quindi il LogMessage metodo per scrivere messaggi di stato nel file di log di installazione e nella console.

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

Commenti

Quando viene creato un nuovo InstallContext , i parametri della riga di comando vengono analizzati nella Parameters proprietà. Sia le chiavi che i valori dei parametri sono stringhe.

Si applica a

Vedi anche