.NET Framework Class Library
Installer.Context Property

Gets or sets information about the current installation.

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

Syntax

Visual Basic (Declaration)
Public Property Context As InstallContext
Visual Basic (Usage)
Dim instance As Installer
Dim value As InstallContext

value = instance.Context

instance.Context = value
C#
public InstallContext Context { get; set; 
C++
public:
property InstallContext^ Context {
    InstallContext^ get ();
    void set (InstallContext^ value);
J#
/** @property */
public InstallContext get_Context ()

/** @property */
public void set_Context (InstallContext value)
JScript
public function get Context () : InstallContext

public function set Context (value : InstallContext)

Property Value

An InstallContext that contains information about the current installation.
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.

Example

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.

Visual Basic
Dim myStringDictionary As StringDictionary = Context.Parameters
If Context.Parameters.Count > 0 Then
   Console.WriteLine("Context Property : ")
   Dim myString As String
   For Each myString In  Context.Parameters.Keys
      Console.WriteLine(Context.Parameters(myString))
   Next myString
End If
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 ] );
   
C++
StringDictionary^ myStringDictionary = Context->Parameters;
if ( Context->Parameters->Count > 0 )
{
   Console::WriteLine( "Context Property : " );
   IEnumerator^ myEnum = Context->Parameters->Keys->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      String^ myString = safe_cast<String^>(myEnum->Current);
      Console::WriteLine( Context->Parameters[ myString ] );
   
J#
StringDictionary myStringDictionary = get_Context().get_Parameters();
if (get_Context().get_Parameters().get_Count() > 0) {
    Console.WriteLine("Context Property : ");
    IEnumerator myEnum = get_Context().get_Parameters().
        get_Keys().GetEnumerator();
    while (myEnum.MoveNext()) {
        String myString = (String)myEnum.get_Current();
        Console.WriteLine(get_Context().get_Parameters().
            get_Item(myString));
    
.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