0

这可能是一个新手问题,所以请原谅。

我的安装工作正常,没有任何错误,所有文件都被复制到安装文件夹但没有安装服务?任何帮助表示赞赏。

我有一个简单的安装,将几个文件复制到安装目录中,然后从已安装的文件之一安装服务。这是我的program.cs相关代码

   WixSharp.File service;

    var project = new ManagedProject("DMACSServer",
           new Dir( @"%ProgramFiles%\DRR\DMACS SLM",
           new DirFiles(@"Z:\DEV\current\FrameworkDLLS\*.*")));
    new Dir(@"%ProgramFiles%\DRR\DMACS SLM",
service = new WixSharp.File(@"Z:\DEV\current\FrameworkDLLS\SLMService.exe"));

    service.ServiceInstaller = new ServiceInstaller
    {
        Name = "DMACS SLM Service",
        StartOn = SvcEvent.Install, //set it to null if you don't want service to start as during deployment
        StopOn = SvcEvent.InstallUninstall_Wait,
        RemoveOn = SvcEvent.Uninstall_Wait,
        //DelayedAutoStart = true,
    };



    project.GUID = new Guid("97b17bfe-6086-4072-8f23-6859a44c4fa4");


    project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;

    project.ManagedUI = ManagedUI.Empty;    //no standard UI dialogs
    project.ManagedUI = ManagedUI.Default;  //all standard UI dialogs

    //custom set of standard UI dialogs
    project.ManagedUI = new ManagedUI();

    project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
                                    .Add<EnvironmentDialog>()
                                    .Add<RolesDialog>()
                                    .Add(Dialogs.InstallDir)
                                    .Add(Dialogs.Progress)
                                    .Add(Dialogs.Exit);

    project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
                                   .Add(Dialogs.Features)
                                   .Add(Dialogs.Progress)
                                   .Add(Dialogs.Exit);

    project.Load += Msi_Load;
    project.BeforeInstall += Msi_BeforeInstall;
    project.AfterInstall += Msi_AfterInstall;
    project.PreserveTempFiles = true;
    //project.SourceBaseDir = "<input dir path>";
    //project.OutDir = "<output dir path>";

    project.BuildMsi(); 
4

0 回答 0