안녕하세요, 신들이시여,
최근에 Setup Project를 사용해 프로그램을 패키징하고 있는데, 이름은 A입니다. 프로젝트 요구사항 때문에 A 설치 시 InstallShield에서 패키지로 만든 설치 패키지 B를 설치해야 했습니다. 이 일에서. AfterInstall과 this.beforeUninstall parts는 각각 "Install"과 "Reverse Install" B 코드를 추가합니다. 그러나 원활하게 실행되지 못했고, B가 생성한 setup.log는 ResultCode=-3을 얻었으나, 그 이유는 알려지지 않았습니다...
이사회 신께 부탁드려요, 이 문제는 오랫동안 제 동생을 괴롭혔고, 저는 해결하지 못했어요... 감사합니다!!
다음 코드에서는 InstallerHelper_AfterInstall와 InstallerHelper_BeforeUninstall에 있던 코드가 새로 생성된 C# 콘솔 프로그램에 배치되지만, 정상적으로 실행될 수 있습니다. WaitforExit()도 매끄럽게 멈출 수 있고, B 설치 패키지도 원활하게 실행할 수 있습니다. ResultCode=0입니다.
코드는 다음과 같습니다: -- System을 사용; System.Collections를 사용; System.Collections.Generic을 사용; System.ComponentModel을 사용; System.Configuration.Install을 사용; System.Linq를 사용; System.Threading.Tasks를 사용; System.Configuration을 사용; System.Windows를 사용; System.IO; System.Diagnostics를 사용; System.Threading을 사용;
이름 공간 FRWebService
{ [RunInstaller(true)] public partial class InstallerHelper : Installer { public InstallerHelper() {
InitializeComponent();
이거. BeforeInstall += new InstallEventHandler(InstallerHelper_BeforeInstall); 이거. AfterInstall += new InstallEventHandler(InstallerHelper_AfterInstall);
이거. BeforeUninstall += new InstallEventHandler(InstallerHelper_BeforeUninstall); 이거. AfterUninstall += new InstallEventHandler(InstallerHelper_AfterUninstall); }
private void InstallerHelper_BeforeUninstall(object sender, InstallEventArgs e) { 시도해 { 문자열 arg = "/s /uninst"; Process p = Process.Start("C:\\Program Files\\Test\\setup_io.exe", arg); p.WaitForInputIdle(); p.WaitForExit();
} catch (예외 예) {
} }
private void InstallerHelper_BeforeInstall(object sender, InstallEventArgs e) {
}
private void InstallerHelper_Committing(object sender, InstallEventArgs e) {
}
private void InstallerHelper_Committed(object sender, InstallEventArgs e) {
}
private void InstallerHelper_AfterInstall(object sender, InstallEventArgs e) { 시도해 { 문자열 arg = "/s"; Process p = Process.Start("C:\\Program Files\\Test\\setup_io.exe", arg); p.WaitForInputIdle(); p.WaitForExit(); } catch (예외 예) {
} }
private void InstallerHelper_AfterUninstall(object sender, InstallEventArgs e) {
}
애플리케이션 설치 시 수행해야 할 코드 public override void Install(System.Collections.IDictionary stateSaver) { System.Diagnostics.Debugger.Launch(); 기지. Install(stateSaver); System.Windows.Forms.MessageBox.Show("애플리케이션 설치 중..."); }
public override void Uninstall(System.Collections.IDictionary stateSaver) { System.Diagnostics.Debugger.Launch(); 기지. Uninstall(stateSaver); System.Windows.Forms.MessageBox.Show("애플리케이션 삭제 완료..."); }
}
} --
|