Bagikan melalui


InstallContext.Parameters Properti

Definisi

Mendapatkan parameter baris perintah yang dimasukkan saat InstallUtil.exe dijalankan.

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

Nilai Properti

StringDictionary yang mewakili parameter baris perintah yang dimasukkan saat penginstalan yang dapat dieksekusi dijalankan.

Contoh

Contoh ini adalah kutipan contoh dalam ringkasan InstallContext kelas kelas.

Sampel mengambil Parameters properti untuk melihat apakah ada argumen baris perintah yang telah dimasukkan oleh pengguna. Ini juga menggunakan IsParameterTrue metode untuk mengetahui apakah LogtoConsole parameter telah ditetapkan. Jika yes, maka akan menggunakan LogMessage metode untuk menulis pesan status ke file log penginstalan dan konsol.

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

Keterangan

Saat baru InstallContext dibuat, parameter baris perintah diurai ke Parameters dalam properti . Kunci dan nilai parameter adalah string.

Berlaku untuk

Lihat juga