Salut, zei,
Am folosit recent Setup Project pentru a împacheta programul și se numește A. Din cauza cerințelor proiectului, a trebuit să instalez un pachet de instalare B ambalat de InstallShield în timpul instalării A. În asta. AfterInstall și aceasta. Părțile BeforeUninstall adaugă codul "Install" și "Reverse Install" B, respectiv. Totuși, nu a putut fi executat lin, iar setup.log generat de B a obținut ResultCode=-3, dar motivul este necunoscut...
Implor zeul consiliului să mă ajute, această problemă îl frământă pe fratele meu mai mic de mult timp și nu am reușit să o rezolv... Vă mulțumesc!!
În codul următor, codul din InstallerHelper_AfterInstall și InstallerHelper_BeforeUninstall este plasat în noul program de consolă C# creat, dar poate rula normal. Și WaitforExit() poate rămâne blocat fără probleme, iar pachetul de instalare B poate fi executat fără probleme, ResultCode=0.
Codul este următorul: -- folosind Sistem; folosind System.Collections; folosind System.Collections.Generic; folosind System.ComponentModel; folosind System.Configuration.Install; folosind System.Linq; folosind System.Threading.Tasks; folosind System.Configuration; folosind System.Windows; folosind System.IO; folosind System.Diagnostics; folosind System.Threading;
Spațiul de nume FRWebService
{ [RunInstaller(true)] clasa parțială publică InstallerHelper : Installer { public InstallerHelper() {
InitializeComponent();
Asta. ÎnainteDeInstalare += nou InstallEventHandler(InstallerHelper_BeforeInstall); Asta. AfterInstall += noul InstallEventHandler(InstallerHelper_AfterInstall);
Asta. ÎnainteUninstall += nou InstallEventHandler(InstallerHelper_BeforeUninstall); Asta. AfterUninstall += noul InstallEventHandler(InstallerHelper_AfterUninstall); }
private void InstallerHelper_BeforeUninstall(object sender, InstallEventArgs e) { încearcă { String arg = "/s /uninst"; Process p = Process.Start("C:\\Program Files\\Test\\setup_io.exe", arg); p.WaitForInputIdle(); p.AșteptăpenIeșire();
} catch (excepție ex) {
} }
privat void InstallerHelper_BeforeInstall(object sender, InstallEventArgs e) {
}
privat void InstallerHelper_Committing(object sender, InstallEventArgs e) {
}
privat void InstallerHelper_Committed(object sender, InstallEventArgs e) {
}
privat void InstallerHelper_AfterInstall(object sender, InstallEventArgs e) { încearcă { String arg = "/s"; Process p = Process.Start("C:\\Program Files\\Test\\setup_io.exe", arg); p.WaitForInputIdle(); p.AșteptăpenIeșire(); } catch (excepție ex) {
} }
privat void InstallerHelper_AfterUninstall(object sender, InstallEventArgs e) {
}
Cod de executat în momentul instalării aplicației public override void Install(System.Collections.IDictionary stateSaver) { System.Diagnostics.Debugger.Launch(); bază. Install(stateSaver); System.Windows.Forms.MessageBox.Show("Instalare aplicație..."); }
public override void Uninstall(System.Collections.IDictionary stateSaver) { System.Diagnostics.Debugger.Launch(); bază. Dezinstalare (stateSaver); System.Windows.Forms.MessageBox.Show("Deinstalare aplicație..."); }
}
} --
|