private static string BuildServiceMsi() { File service; var project = new ManagedProject("LMS", new Dir(@"%ProgramFiles%\License Monitoring System", new DirPermission("LocalSystem", GenericPermission.All), service = new File(new Id("LMS_file"), "%SolutionDir%\\LMS.Service\\bin\\%Configuration%\\LMS.exe"), new DirFiles("%SolutionDir%\\LMS.Service\\bin\\%Configuration%\\*.*", f => !f.EndsWith("LMS.exe"))) ) { ControlPanelInfo = new ProductInfo { HelpTelephone = "0845 413 88 99", Manufacturer = "Central Technology Ltd", NoModify = true, NoRepair = true, ProductIcon = "app_icon.ico" }, InstallScope = InstallScope.perMachine, Name = Constants.ServiceDisplayName, OutDir = "bin\\%Configuration%", UI = WUI.WixUI_Minimal, GUID = new Guid("ADAC7706-188B-42E7-922B-50786779042A"), RebootSupressing = RebootSupressing.ReallySuppress }; project.BeforeInstall += Project_BeforeInstall; project.SetVersionFrom("LMS_file"); project.SetNetFxPrerequisite("WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"); project.CustomIdAlgorithm = project.HashedTargetPathIdAlgorithm; service.ServiceInstaller = new ServiceInstaller { DelayedAutoStart = true, Description = Constants.ServiceDescription, DisplayName = Constants.ServiceDisplayName, FirstFailureActionType = FailureActionType.restart, Name = Constants.ServiceName, RemoveOn = SvcEvent.Uninstall_Wait, ResetPeriodInDays = 1, RestartServiceDelayInSeconds = 30, SecondFailureActionType = FailureActionType.restart, ServiceSid = ServiceSid.none, StartOn = SvcEvent.Install, StopOn = SvcEvent.InstallUninstall_Wait, StartType = SvcStartType.auto, ThirdFailureActionType = FailureActionType.restart, Vital = true }; project.MajorUpgrade = new MajorUpgrade { Schedule = UpgradeSchedule.afterInstallInitialize, DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit." }; _version = project.Version; return(Compiler.BuildMsi(project)); }