Freigeben über


InstallContext.Parameters-Eigenschaft

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

Namespace: System.Configuration.Install
Assembly: System.Configuration.Install (in system.configuration.install.dll)

Syntax

'Declaration
Public ReadOnly Property Parameters As StringDictionary
'Usage
Dim instance As InstallContext
Dim value As StringDictionary

value = instance.Parameters
public StringDictionary Parameters { get; }
public:
property StringDictionary^ Parameters {
    StringDictionary^ get ();
}
/** @property */
public StringDictionary get_Parameters ()
public function get Parameters () : StringDictionary

Eigenschaftenwert

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

Hinweise

Beim Erstellen eines neuen InstallContext werden die Befehlszeilenparameter in die Parameters-Eigenschaft eingelesen. Sowohl die Schlüssel als auch die Werte der Parameter sind Zeichenfolgen.

Beispiel

Dieses Beispiel ist ein Auszug aus dem Beispiel in der Klassenübersicht zur InstallContext-Klasse.

Im Beispiel wird die Parameters-Eigenschaft abgerufen, um festzustellen, ob vom Benutzer Befehlszeilenargumente eingegeben wurden. Darüber hinaus wird mithilfe der IsParameterTrue-Methode ermittelt, ob der LogtoConsole-Parameter festgelegt wurde. Bei yes werden anschließend mit der LogMessage-Methode Statusmeldungen in die Installationsprotokolldatei und auf die Konsole geschrieben.

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
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" );
   }
}
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.get_Parameters();
if (myStringDictionary.get_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");
    }
}

.NET Framework-Sicherheit

  • Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

InstallContext-Klasse
InstallContext-Member
System.Configuration.Install-Namespace
StringDictionary