다음을 통해 공유


InstallContext 생성자

정의

InstallContext 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
InstallContext()

InstallContext 클래스의 새 인스턴스를 초기화합니다.

InstallContext(String, String[])

클래스의 새 인스턴스를 InstallContext 초기화하고 설치를 위한 로그 파일을 만듭니다.

InstallContext()

InstallContext 클래스의 새 인스턴스를 초기화합니다.

public:
 InstallContext();
public InstallContext();
Public Sub New ()

예제

메모

이 예제에서는 생성자의 오버로드된 버전 InstallContext 중 하나를 사용하는 방법을 보여줍니다. 사용할 수 있는 다른 예제는 개별 오버로드 항목을 참조하세요.

인수 없이 프로그램을 호출하면 빈 InstallContext 항목이 만들어집니다.

// There are no command line arguments, create an empty 'InstallContext'.
myInstallObject->myInstallContext = gcnew InstallContext;
// There are no command line arguments, create an empty 'InstallContext'.
myInstallObject.myInstallContext = new InstallContext();
' There are no command line arguments, create an empty 'InstallContext'.
myInstallObject.myInstallContext = New InstallContext()

설명

이 오버로드는 설치에 대한 로그 파일을 만들지 않습니다.

적용 대상

InstallContext(String, String[])

클래스의 새 인스턴스를 InstallContext 초기화하고 설치를 위한 로그 파일을 만듭니다.

public:
 InstallContext(System::String ^ logFilePath, cli::array <System::String ^> ^ commandLine);
public InstallContext(string logFilePath, string[] commandLine);
new System.Configuration.Install.InstallContext : string * string[] -> System.Configuration.Install.InstallContext
Public Sub New (logFilePath As String, commandLine As String())

매개 변수

logFilePath
String

이 설치에 대한 로그 파일의 경로이거나 null 로그 파일을 만들어야 하는 경우

commandLine
String[]

설치 프로그램을 실행할 때 입력된 명령줄 매개 변수이거나 null 입력된 매개 변수가 없는 경우

예제

이 예제는 클래스의 클래스 개요에 있는 예제의 InstallContext 발췌입니다.

"/LogFile" 및 "/LogtoConsole"을 지정 InstallContext 하면 해당 인수 InstallContext를 에 전달하여 생성됩니다.

// Create an InstallContext object with the given parameters.
array<String^>^commandLine = gcnew array<String^>(args->Length - 1);
for ( int i = 0; i < args->Length - 1; i++ )
{
   commandLine[ i ] = args[ i + 1 ];
}
myInstallObject->myInstallContext = gcnew InstallContext( args[ 1 ],commandLine );
// Create an InstallContext object with the given parameters.
String[] commandLine = new string[ args.Length ];
for( int i = 0; i < args.Length; i++ )
{
   commandLine[ i ] = args[ i ];
}
myInstallObject.myInstallContext = new InstallContext( args[ 0 ], commandLine);
' Create an InstallContext object with the given parameters.
Dim commandLine() As String = New String(args.Length - 2) {}
Dim i As Integer
For i = 1 To args.Length - 1
   commandLine(i-1) = args(i)
Next i
myInstallObject.myInstallContext = _
   New InstallContext("/LogFile:example.log", commandLine)

설명

설치에서 Installutil.exe(설치 관리자 도구)를 사용하는 경우 이 생성자는 지정된 경로에 로그 파일을 만들고 명령줄 매개 변수 배열을 속성으로 Parameters 구문 분석합니다. 명령줄 매개 변수에 로그 파일 경로가 지정된 경우 파일을 만드는 데 사용됩니다. 명령줄에 로그 파일 인수를 지정하지 않으면 매개 변수 값 logFilePath 이 사용됩니다. 로그 파일 생성을 표시하지 않으면 "/logfile= " 명령줄 매개 변수를 전달합니다.

호출자 참고

이 생성자를 호출할 때 매개 변수에 logFilePath 기본 로그 파일 경로를 전달합니다. 설치 실행 파일을 실행할 때 /logfile 명령줄 매개 변수가 사용되지 않는 한 로그 파일이 만들어지는 위치입니다.

추가 정보

적용 대상