InstallContext.Parameters Właściwość

Definicja

Pobiera parametry wiersza polecenia wprowadzone podczas uruchamiania 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

Wartość właściwości

Element StringDictionary reprezentujący parametry wiersza polecenia wprowadzone podczas uruchamiania pliku wykonywalnego instalacji.

Przykłady

Ten przykład jest fragmentem przykładu w przeglądu klasy klasy InstallContext .

Przykład pobiera właściwość , Parameters aby sprawdzić, czy jakikolwiek argument wiersza polecenia został wprowadzony przez użytkownika. Używa również IsParameterTrue metody , aby dowiedzieć się, czy LogtoConsole parametr został ustawiony. Jeśli yes, użyje metody LogMessage do zapisywania komunikatów o stanie do pliku dziennika instalacji i konsoli programu .

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

Uwagi

Po utworzeniu nowego InstallContext parametry wiersza polecenia są analizowane we Parameters właściwości . Zarówno klucze, jak i wartości parametrów są ciągami.

Dotyczy

Zobacz też