Compartir a través de


InstallContext.Parameters Propiedad

Definición

Obtiene los parámetros de la línea de comandos que se especificaron al ejecutar 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

Valor de propiedad

StringDictionary que representa los parámetros de la línea de comandos que se especificaron al ejecutar el ejecutable de instalación.

Ejemplos

Este ejemplo es un extracto del ejemplo en la información general de la clase .InstallContext

El ejemplo recupera la Parameters propiedad para ver si el usuario ha escrito algún argumento de línea de comandos. También usa el IsParameterTrue método para averiguar si se ha establecido el LogtoConsole parámetro . Si yeses , usará el LogMessage método para escribir mensajes de estado en el archivo de registro de instalación y en la consola.

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

Comentarios

Cuando se crea un nuevo InstallContext , los parámetros de la línea de comandos se analizan en la Parameters propiedad . Tanto las claves como los valores de los parámetros son cadenas.

Se aplica a

Consulte también