System.Configuration.Install 네임스페이스의 Installer 를 이용한 설치 프로젝트 작성

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Configuration.Install;

namespace WindowsApplication
{
[System.ComponentModel.RunInstaller(true)]
public class SetupInstaller : System.Configuration.Install.Installer
{
public SetupInstaller()
{
this.AfterInstall += new InstallEventHandler(SetupInstaller_AfterInstall);
this.BeforeInstall += new InstallEventHandler(SetupInstaller_BeforeInstall);
this.Committed += new InstallEventHandler(SetupInstaller_Committed);
}

// 셋업 설치가 완료되었을 때 호출
void SetupInstaller_Committed(object sender, InstallEventArgs e)
{
// 아래 그림 3의 CustomActionData 내의 값을 읽어온다.
string name = Context.Parameters["CUSTOM1"];
string age = Context.Parameters["CUSTOM2"];

MessageBox.Show(name + "\r\n" + age);
}

// WindowsApplication.exe 파일이 설치되기 직전에 호출
void SetupInstaller_BeforeInstall(object sender, InstallEventArgs e)
{
MessageBox.Show("beforeInstall");
}

// WindowsApplication.exe 파일이 설치된후에 호출
void SetupInstaller_AfterInstall(object sender, InstallEventArgs e)
{
MessageBox.Show("afterInstall");
}
}
}

[그림 1]
사용자 지정 작업 화면에서 위의 애트리뷰트가 구현된 실행파일을 등록한다. 그러면 셋업 설치시 혹은 설치가 완료되고 나서 해당 이벤트가 발생하게 된다.
사용자 삽입 이미지

 

 

 

 

 

 

 

 

 

 

[그림 2]
사용자 인터페이스 화면에서 새로운 입력란 대화상자를 추가하는 화면이다.
속성 페이지의 EditxProperty 값을 이용하여 그림3의 CustomActionData 에 값을 설정하면 소스 코드에서 이 값을 읽어들일 수 있다.
사용자 삽입 이미지

 

 

 

 

 

 

 

 

 

 

[그림 3]
위 그림 2의 EditxProperty 값을 CustomActionData 항목에 설정하는 화면
사용자 삽입 이미지

 

 

 

 

 

 

 

 

 

 

Related Posts

답글 남기기

이메일 주소는 공개되지 않습니다.