InstallContext.Parameters Propriedade

Definição

Obtém os parâmetros de linha de comando que foram inseridos quando o InstallUtil.exe foi executado.

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

Valor da propriedade

Um StringDictionary que representa os parâmetros de linha de comando que foram inseridos quando o executável de instalação foi executado.

Exemplos

Este exemplo é um trecho do exemplo na visão geral da classe da InstallContext classe .

O exemplo recupera a Parameters propriedade para ver se algum argumento de linha de comando foi inserido pelo usuário. Ele também usa o IsParameterTrue método para descobrir se o LogtoConsole parâmetro foi definido. Se yes, ele usará o LogMessage método para gravar status mensagens no arquivo de log de instalação e no 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

Comentários

Quando um novo InstallContext é criado, os parâmetros de linha de comando são analisados na Parameters propriedade . As chaves e os valores dos parâmetros são cadeias de caracteres.

Aplica-se a

Confira também