Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Installer Class
 Context Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.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)
Visual Basic (Declaration)
<BrowsableAttribute(False)> _
Public Property Context As InstallContext
Visual Basic (Usage)
Dim instance As Installer
Dim value As InstallContext

value = instance.Context

instance.Context = value
C#
[BrowsableAttribute(false)]
public InstallContext Context { get; set; }
Visual C++
[BrowsableAttribute(false)]
public:
property InstallContext^ Context {
    InstallContext^ get ();
    void set (InstallContext^ value);
}
JScript
public function get Context () : InstallContext
public function set Context (value : InstallContext)

Property Value

Type: System.Configuration.Install..::.InstallContext
An InstallContext that contains information about the current installation.

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.

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 ] );
   }
}

Visual 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 ] );
   }
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker