InstallContext.IsParameterTrue(String) Method

Definition

Determines whether the specified command-line parameter is true.

public bool IsParameterTrue(string paramName);

Parameters

paramName
String

The name of the command-line parameter to check.

Returns

true if the specified parameter is set to "yes", "true", "1", or an empty string (""); otherwise, false.

Examples

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

It 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.

// 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" );
}

Remarks

This method accesses the Parameters property, which contains a parsed version of the command-line parameters, to determine whether the specified parameter is true.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also