Installer.Context Property

Definition

Gets or sets information about the current installation.

C#
[System.ComponentModel.Browsable(false)]
public System.Configuration.Install.InstallContext Context { get; set; }

Property Value

An InstallContext that contains information about the current installation.

Attributes

Examples

The following example demonstrates the Context property of the Installer class. The contents of the Context property contain information about the location of the log file for the installation, the location of the file to save information required by the Uninstall method, and the command line that was entered when the installation executable was run. These contents are then displayed on the console.

C#
StringDictionary myStringDictionary = Context.Parameters;
if ( Context.Parameters.Count > 0 )
{
   Console.WriteLine("Context Property : " );
   foreach( string myString in Context.Parameters.Keys)
   {
      Console.WriteLine( Context.Parameters[ myString ] );
   }
}

Remarks

The Context property contains installation information. For example, information about the location of the log file for the installation, the location of the file to save information required by the Uninstall method, and the command line that was entered when the installation executable was run.

The program that calls the Install, Commit, Rollback, or Uninstall methods sets the Context property with information that the methods need.

If an installer belongs to an installer collection, the parent installer sets the Context property before calling any of these methods. The parent installer can be accessed through the Parent property.

Applies to

Produk Versi
.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