.NET Framework Class Library
InstallContext.Parameters Property

Gets the command-line parameters that were entered when InstallUtil.exe was run.

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

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Parameters As StringDictionary
Visual Basic (Usage)
Dim instance As InstallContext
Dim value As StringDictionary

value = instance.Parameters
C#
public StringDictionary Parameters { get; 
C++
public:
property StringDictionary^ Parameters {
    StringDictionary^ get ();
J#
/** @property */
public StringDictionary get_Parameters ()
JScript
public function get Parameters () : StringDictionary

Property Value

A StringDictionary that represents the command-line parameters that were entered when the installation executable was run.
Remarks

When a new InstallContext is created, the command-line parameters are parsed into the Parameters property. Both the keys and the values of the parameters are strings.

Example

This example is an excerpt of the example in the class overview of InstallContext class.

The sample retrieves the Parameters property to see if any command line argument has been entered by the user. It also uses the IsParameterTrue method to find out if the LogtoConsole parameter has been set. If yes, it will then use the LogMessage method to write status messages to the installation log file and the console.

Visual Basic
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
C#
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" );
   
C++
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" );
   
J#
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 Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Platforms

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0
See Also

Tags :


Page view tracker