代碼如下:
--
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.Threading.Tasks;
using System.Configuration;
using System.Windows;
using System.IO;
using System.Diagnostics;
using System.Threading;
namespace FRWebService
{
[RunInstaller(true)]
public partial class InstallerHelper : Installer
{
public InstallerHelper()
{
InitializeComponent();
this.BeforeInstall += new InstallEventHandler(InstallerHelper_BeforeInstall);
this.AfterInstall += new InstallEventHandler(InstallerHelper_AfterInstall);
this.BeforeUninstall += new InstallEventHandler(InstallerHelper_BeforeUninstall);
this.AfterUninstall += new InstallEventHandler(InstallerHelper_AfterUninstall);
}
//Code to perform at the time of installing application
public override void Install(System.Collections.IDictionary stateSaver)
{
System.Diagnostics.Debugger.Launch();
base.Install(stateSaver);
System.Windows.Forms.MessageBox.Show("Installing Application...");
}