Beispiel #1
0
        public void FirewallException()
        {
            var obj = new FirewallException(new Id("idTest"), "Test")
            {
                Description   = "descr",
                File          = "fff",
                IgnoreFailure = true,
                Port          = "80",
                Profile       = FirewallExceptionProfile.@public,
                Program       = "prog",
                Protocol      = FirewallExceptionProtocol.tcp,
                Scope         = FirewallExceptionScope.localSubnet,
            };

            XElement xml = obj.ToXElement("FirewallException");

            Assert.Equal("descr", xml.Attribute("Description").Value);
            Assert.Equal("fff", xml.Attribute("File").Value);
            Assert.Equal("yes", xml.Attribute("IgnoreFailure").Value);
            Assert.Equal("80", xml.Attribute("Port").Value);
            Assert.Equal("public", xml.Attribute("Profile").Value);
            Assert.Equal("prog", xml.Attribute("Program").Value);
            Assert.Equal("tcp", xml.Attribute("Protocol").Value);
            Assert.Equal("localSubnet", xml.Attribute("Scope").Value);
            Assert.Equal("idTest", xml.Attribute("Id").Value);
            Assert.Equal("Test", xml.Attribute("Name").Value);
        }
Beispiel #2
0
        private static string BuildMsiLogServer()
        {
            Environment.SetEnvironmentVariable("LogServer",
                                               @"..\..\..\build\KSociety.Log.Srv.Host\Release\net5.0\publish");

            #region [Firewall]

            var serviceLogServerFw = new FirewallException
            {
                Id            = "LOG_SERVER_ID",
                Description   = "LogServer",
                Name          = "LogServer",
                IgnoreFailure = true,
                Profile       = FirewallExceptionProfile.all,
                Scope         = FirewallExceptionScope.any
            };

            #endregion

            #region [Feature]

            Feature binaries  = new Feature("Binaries", "Binaries", true, false);
            Feature logServer = new Feature("LogServer", "LogServer", true);

            binaries.Children.Add(logServer);

            #endregion

            File logService;

            //File service = new File();
            Project project = new Project("LogServer",
                                          new Dir(new Id("INSTALLDIR"), @"%ProgramFiles%\" + Manufacturer + @"\" + Product,
                                                  new Dir(new Id("LOGSERVERDIR"), logServer, "LogServer",
                                                          new Files(logServer, @"%LogServer%\*.*", f => !f.Contains("KSociety.Log.Srv.Host.exe")),
                                                          logService = new File(logServer, @"%LogServer%\KSociety.Log.Srv.Host.exe", serviceLogServerFw)
                                                          ) // LOGSERVER.
                                                  )         // INSTALLDIR.
                                                            //new Dir(new Id("PROGRAMMENU"),@"%ProgramMenu%\K-Society\Log System\LogServer",
                                                            //    new ExeFileShortcut(new Id("LOGSERVERUNINSTALL"), logServer, "Uninstall Log Server", "[SystemFolder]msiexec.exe",
                                                            //        "/x [ProductCode]")
                                                            //) //Shortcut
                                          )
            {
                //InstallPrivileges = InstallPrivileges.elevated,
                InstallScope     = InstallScope.perMachine,
                Platform         = Platform.x64,
                Version          = new Version("1.0.0.0"),
                GUID             = new Guid("7AF94E29-7447-48B7-B4CC-3AD186B43C81"),
                UI               = WUI.WixUI_ProgressOnly,
                ControlPanelInfo = new ProductInfo
                {
                    Manufacturer = Manufacturer
                }
                //Actions = new WixSharp.Action[]
                //{
                //    new ElevatedManagedAction(ServiceManager.InstallService, Return.check, When.After, Step.InstallFiles, Condition.NOT_Installed)
                //    {
                //        UsesProperties = "InstallState=[INSTALLSTATEDIR], ServiceName=[INSTALLDIR]Std.Srv.Host.Log.exe",
                //        ActionAssembly = typeof(ServiceManager).Assembly.Location
                //    },
                //    new ElevatedManagedAction(ServiceManager.UnInstallService, Return.check, When.Before, Step.RemoveFiles, Condition.BeingUninstalled)
                //    {
                //        UsesProperties = "InstallState=[INSTALLSTATEDIR], ServiceName=[INSTALLDIR]Std.Srv.Host.Log.exe",
                //        ActionAssembly = typeof(ServiceManager).Assembly.Location
                //    }
                //}
            };


            logService.ServiceInstaller = new ServiceInstaller
            {
                Id                           = "LOGSERVER",
                Name                         = "LogServer",
                Description                  = Manufacturer + " Log Server",
                StartOn                      = null,
                StopOn                       = SvcEvent.InstallUninstall_Wait,
                RemoveOn                     = SvcEvent.Uninstall_Wait,
                DelayedAutoStart             = true,
                ServiceSid                   = ServiceSid.none,
                RestartServiceDelayInSeconds = 30,
                ResetPeriodInDays            = 1,
                PreShutdownDelay             = 1000 * 60 * 3,
                RebootMessage                = "Failure actions do not specify reboot"
            };

            project.PreserveTempFiles = false;
            project.PreserveDbgFiles  = false;

            return(project.BuildMsi());
        }
Beispiel #3
0
        private static string BuildMsiLogPresenter()
        {
            Environment.SetEnvironmentVariable("LogPresenter",
                                               @"..\..\..\build\KSociety.Log.Pre.Web.App\Release\net5.0\publish");

            #region [Firewall]

            var serviceLogPresenterFw = new FirewallException
            {
                Id            = "LOG_PRESENTER_ID",
                Description   = "LogPresenter",
                Name          = "LogPresenter",
                IgnoreFailure = true,
                Profile       = FirewallExceptionProfile.all,
                Scope         = FirewallExceptionScope.any
            };

            #endregion

            #region [Feature]

            Feature binaries     = new Feature("Binaries", "Binaries", true, false);
            Feature logPresenter = new Feature("LogPresenter", "LogPresenter", true);

            binaries.Children.Add(logPresenter);

            #endregion

            File logPresenterFile;

            Project project = new Project("LogPresenter",
                                          new Dir(new Id("INSTALLDIR"), @"%ProgramFiles%\" + Manufacturer + @"\" + Product,
                                                  new Dir(new Id("DIAPRESENTERDIR"), logPresenter, "LogPresenter",
                                                          new Files(logPresenter, @"%LogPresenter%\*.*", f => !f.Contains("KSociety.Log.Pre.Web.App.exe")),
                                                          logPresenterFile = new File(logPresenter, @"%LogPresenter%\KSociety.Log.Pre.Web.App.exe", serviceLogPresenterFw)
                                                          ) // DIAPRESENTERDIR.
                                                  )         // INSTALLDIR.
                                          )
            {
                InstallScope     = InstallScope.perMachine,
                Platform         = Platform.x64,
                Version          = new Version("1.0.0.0"),
                GUID             = new Guid("10962664-C32B-4045-BA9F-59CF5909A2FB"),
                UI               = WUI.WixUI_ProgressOnly,
                ControlPanelInfo = new ProductInfo
                {
                    Manufacturer = Manufacturer
                }
            };

            logPresenterFile.ServiceInstaller = new ServiceInstaller
            {
                Id                           = "LOGPRESENTER",
                Name                         = "LogPresenter",
                Description                  = Manufacturer + " Log Presenter",
                StartOn                      = null,
                StopOn                       = SvcEvent.InstallUninstall_Wait,
                RemoveOn                     = SvcEvent.Uninstall_Wait,
                DelayedAutoStart             = false,
                ServiceSid                   = ServiceSid.none,
                RestartServiceDelayInSeconds = 30,
                ResetPeriodInDays            = 1,
                PreShutdownDelay             = 1000 * 60 * 3,
                RebootMessage                = "Failure actions do not specify reboot"
            };

            return(project.BuildMsi());
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var projectName = $"KL² Server v{ToCompactVersionString(Version.Parse(API_VersionToBuild))}";

            /////////////// KL² API MSI ///////////////
            var API_projectName = $"{API_appName} v{ToCompactVersionString(Version.Parse(API_VersionToBuild))}";

            Dir API_scannAppDir = ScanFiles("API",
                                            System.IO.Path.GetFullPath(@"..\KL2-Core\KProcess.KL2.API\bin\Release"),
                                            (file) => file.EndsWith(".pdb") || (file.EndsWith(".xml") && !file.EndsWith("PublicKey.xml")) || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest"));
            Dir API_appDir = new Dir(@"C:",
                                     new Dir("K-process",
                                             new Dir("KL² Suite", API_scannAppDir)));

            RegValue API_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, API_regKey, "InstallLocation", "[INSTALLDIR]");

            UrlReservation    API_urlAcl   = new UrlReservation("http://*:8081/", "*S-1-1-0", UrlReservationRights.all);
            FirewallException API_firewall = new FirewallException("KL2-API")
            {
                Scope         = FirewallExceptionScope.any,
                IgnoreFailure = true,
                Port          = "8081"
            };

            ManagedAction         API_editConfig       = new ManagedAction(CustomActions.API_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed);
            ElevatedManagedAction API_uninstallService = new ElevatedManagedAction(CustomActions.API_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled);

            var API_project = new ManagedProject(API_projectName, API_appDir, API_installReg, API_urlAcl, API_firewall, API_editConfig, API_uninstallService)
            {
                GUID                 = Versions.API_List.Single(_ => _.Key.ToString() == API_VersionToBuild).Value,
                Version              = Version.Parse(API_VersionToBuild),
                UpgradeCode          = API_UpgradeCode,
                AttributesDefinition = $"Id={Versions.API_List.Single(_ => _.Key.ToString() == API_VersionToBuild).Value};Manufacturer={manufacturer}",
                Description          = $"{API_projectName},{manufacturer}",
                InstallScope         = InstallScope.perMachine,
                Properties           = new[]
                {
                    new Property("DATASOURCE", @"(LocalDb)\KL2"),
                    new Property("APPLICATION_URL", "http://*:8081"),
                    new Property("FILESERVER_LOCATION", "http://*****:*****@"..\..\Assets\kl2_Suite.ico";
            API_project.MajorUpgrade = new MajorUpgrade
            {
                AllowSameVersionUpgrades = true,
                DowngradeErrorMessage    = "A later version of [ProductName] is already installed. Setup will now exit."
            };
            API_project.Include(WixExtension.Util)
            .Include(WixExtension.Http);
            API_project.WixVariables.Add("WixUILicenseRtf", "License.rtf");
            API_project.BeforeInstall += API_Project_BeforeInstall;
            API_project.AfterInstall  += API_Project_AfterInstall;

            // Save the list of files to check integrity
            void LogFiles(System.IO.StreamWriter writer, int rootCount, Dir root)
            {
                foreach (var file in root.Files)
                {
                    if (file.Name.EndsWith("WebServer.log"))
                    {
                        continue;
                    }
                    var splittedFileName = file.Name.Split('\\').ToList();
                    for (var i = 0; i < rootCount; i++)
                    {
                        splittedFileName.RemoveAt(0);
                    }
                    writer.WriteLine(string.Join("\\", splittedFileName.ToArray()));
                }
                foreach (var dir in root.Dirs)
                {
                    LogFiles(writer, rootCount, dir);
                }
            }

            using (var writer = System.IO.File.CreateText("API_FileList.txt"))
            {
                var rootCount = API_scannAppDir.Files.First().Name.Split('\\').Length - 1;
                LogFiles(writer, rootCount, API_scannAppDir);
            }

            API_project.BuildWxs(Compiler.OutputType.MSI, "KL2API_project.wxs");
            string API_productMsi = API_project.BuildMsi("KL²API.msi");

            /////////////// KL² FileServer MSI ///////////////
            var FileServer_projectName = $"{FileServer_appName} v{ToCompactVersionString(Version.Parse(FileServer_VersionToBuild))}";

            Dir FileServer_scannAppDir = ScanFiles("FileServer",
                                                   System.IO.Path.GetFullPath(@"..\KL2-Core\Kprocess.KL2.FileServer\bin\Release"),
                                                   (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest"));
            Dir FileServer_appDir = new Dir(@"C:",
                                            new Dir("K-process",
                                                    new Dir("KL² Suite", FileServer_scannAppDir)));

            RegValue FileServer_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, FileServer_regKey, "InstallLocation", "[INSTALLDIR]");

            UrlReservation    FileServer_urlAcl   = new UrlReservation("http://*:8082/", "*S-1-1-0", UrlReservationRights.all);
            FirewallException FileServer_firewall = new FirewallException("KL2-FilesServer")
            {
                Scope         = FirewallExceptionScope.any,
                IgnoreFailure = true,
                Port          = "8082"
            };

            ManagedAction         FileServer_editConfig       = new ManagedAction(CustomActions.FileServer_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed);
            ElevatedManagedAction FileServer_uninstallService = new ElevatedManagedAction(CustomActions.FileServer_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled);

            var FileServer_project = new ManagedProject(FileServer_projectName, FileServer_appDir, FileServer_installReg, FileServer_urlAcl, FileServer_firewall, FileServer_editConfig, FileServer_uninstallService)
            {
                GUID                 = Versions.FileServer_List.Single(_ => _.Key.ToString() == FileServer_VersionToBuild).Value,
                Version              = Version.Parse(FileServer_VersionToBuild),
                UpgradeCode          = FileServer_UpgradeCode,
                AttributesDefinition = $"Id={Versions.FileServer_List.Single(_ => _.Key.ToString() == FileServer_VersionToBuild).Value};Manufacturer={manufacturer}",
                Description          = $"{FileServer_projectName},{manufacturer}",
                InstallScope         = InstallScope.perMachine,
                Properties           = new[]
                {
                    new Property("DATASOURCE", @"(LocalDb)\KL2"),
                    new Property("APPLICATION_URL", "http://*:8082"),
                    new Property("FILE_PROVIDER", "SFtp"),
                    new Property("SERVER", "127.0.0.1"),
                    new Property("PORT", "22"),
                    new Property("USER", "kl2"),
                    new Property("PASSWORD", "kl2"),
                    new Property("PUBLISHED_DIR", "/PublishedFiles"),
                    new Property("UPLOADED_DIR", "/UploadedFiles"),
                    new Property("BUNDLE_ID", "[BUNDLE_ID]")
                }
            };

            FileServer_project.Package.AttributesDefinition = $"Id=*;InstallerVersion=500;Comments={FileServer_projectName};Keywords={FileServer_projectName},{manufacturer}";
            FileServer_project.SetNetFxPrerequisite(new WixSharp.Condition(" (NETFRAMEWORK45 >= '#461308') "), "Please install .Net Framework 4.7.1 first.");
            FileServer_project.ControlPanelInfo.ProductIcon = @"..\..\Assets\kl2_Suite.ico";
            FileServer_project.MajorUpgrade = new MajorUpgrade
            {
                AllowSameVersionUpgrades = true,
                DowngradeErrorMessage    = "A later version of [ProductName] is already installed. Setup will now exit."
            };
            FileServer_project.Include(WixExtension.Util)
            .Include(WixExtension.Http);
            FileServer_project.WixVariables.Add("WixUILicenseRtf", "License.rtf");
            FileServer_project.BeforeInstall += FileServer_Project_BeforeInstall;
            FileServer_project.AfterInstall  += FileServer_Project_AfterInstall;

            // Save the list of files to check integrity
            using (var writer = System.IO.File.CreateText("FileServer_FileList.txt"))
            {
                var rootCount = FileServer_scannAppDir.Files.First().Name.Split('\\').Length - 1;
                LogFiles(writer, rootCount, FileServer_scannAppDir);
            }

            FileServer_project.BuildWxs(Compiler.OutputType.MSI, "KL2FileServer_project.wxs");
            string FileServer_productMsi = FileServer_project.BuildMsi("KL²FileServer.msi");

            /////////////// KL² Notification MSI ///////////////
            var Notification_projectName = $"{Notification_appName} v{ToCompactVersionString(Version.Parse(Notification_VersionToBuild))}";

            Dir Notification_scannAppDir = ScanFiles("Notification",
                                                     System.IO.Path.GetFullPath(@"..\KProcess.KL2.Notification\bin\Release"),
                                                     (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest"));
            Dir Notification_appDir = new Dir(@"C:",
                                              new Dir("K-process",
                                                      new Dir("KL² Suite", Notification_scannAppDir)));

            RegValue Notification_installReg = new RegValue(RegistryHive.LocalMachineOrUsers, Notification_regKey, "InstallLocation", "[INSTALLDIR]");

            ManagedAction         Notification_editConfig       = new ManagedAction(CustomActions.Notification_EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed);
            ElevatedManagedAction Notification_uninstallService = new ElevatedManagedAction(CustomActions.Notification_UninstallService, Return.check, When.Before, Step.RemoveFiles, WixSharp.Condition.BeingUninstalled);

            var Notification_project = new ManagedProject(Notification_projectName, Notification_appDir, Notification_installReg, Notification_editConfig, Notification_uninstallService)
            {
                GUID                 = Versions.Notification_List.Single(_ => _.Key.ToString() == Notification_VersionToBuild).Value,
                Version              = Version.Parse(Notification_VersionToBuild),
                UpgradeCode          = Notification_UpgradeCode,
                AttributesDefinition = $"Id={Versions.Notification_List.Single(_ => _.Key.ToString() == Notification_VersionToBuild).Value};Manufacturer={manufacturer}",
                Description          = $"{Notification_projectName},{manufacturer}",
                InstallScope         = InstallScope.perMachine,
                Properties           = new[]
                {
                    new Property("DATASOURCE", @"(LocalDb)\KL2"),
                    new Property("FILESERVER_LOCATION", "http://*****:*****@"..\..\Assets\kl2_Suite.ico";
            Notification_project.MajorUpgrade = new MajorUpgrade
            {
                AllowSameVersionUpgrades = true,
                DowngradeErrorMessage    = "A later version of [ProductName] is already installed. Setup will now exit."
            };
            Notification_project.WixVariables.Add("WixUILicenseRtf", "License.rtf");
            Notification_project.BeforeInstall += Notification_Project_BeforeInstall;
            Notification_project.AfterInstall  += Notification_Project_AfterInstall;

            // Save the list of files to check integrity
            using (var writer = System.IO.File.CreateText("Notification_FileList.txt"))
            {
                var rootCount = Notification_scannAppDir.Files.First().Name.Split('\\').Length - 1;
                LogFiles(writer, rootCount, Notification_scannAppDir);
            }

            Notification_project.BuildWxs(Compiler.OutputType.MSI, "KL2Notification_project.wxs");
            string Notification_productMsi = Notification_project.BuildMsi("KL²Notification.msi");

            /////////////// KL² WebAdmin MSI ///////////////
            var WebAdmin_projectName = $"{WebAdmin_appName} v{ToCompactVersionString(Version.Parse(WebAdmin_VersionToBuild))}";

            Dir WebAdmin_scannAppDir = ScanWebFiles("KL2 Web Services", System.IO.Path.GetFullPath(@"..\KProcess.KL2.WebAdmin\bin\Release\PublishOutput"),
                                                    new IISVirtualDir
            {
                Name    = "KL2 Web Services",
                AppName = "KL2 Web Services",
                WebSite = new WebSite("KL2 Web Services", "*:8080")
                {
                    InstallWebSite = true
                },
                WebAppPool = new WebAppPool("KL2AppPoolName", "Identity=applicationPoolIdentity")
            });
            Dir WebAdmin_appDir = new Dir(@"C:",
                                          new Dir("inetpub", WebAdmin_scannAppDir)
                                          );

            ElevatedManagedAction WebAdmin_editConfig = new ElevatedManagedAction(CustomActions.WebAdmin_EditConfig, Return.check, When.Before, Step.InstallFinalize, WixSharp.Condition.NOT_Installed)
            {
                UsesProperties = "D_INSTALLDIR=[INSTALLDIR];D_DATASOURCE=[DATASOURCE];D_API_LOCATION=[API_LOCATION];D_FILESERVER_LOCATION=[FILESERVER_LOCATION]"
            };

            UrlReservation    WebAdmin_urlAcl   = new UrlReservation("http://*:8080/", "*S-1-1-0", UrlReservationRights.all);
            FirewallException WebAdmin_firewall = new FirewallException("KL2-WebServices")
            {
                Scope         = FirewallExceptionScope.any,
                IgnoreFailure = true,
                Port          = "8080"
            };

            var WebAdmin_project = new ManagedProject(WebAdmin_projectName, WebAdmin_appDir, WebAdmin_editConfig, WebAdmin_urlAcl, WebAdmin_firewall)
            {
                GUID                 = Versions.WebAdmin_List.Single(_ => _.Key.ToString() == WebAdmin_VersionToBuild).Value,
                Version              = Version.Parse(WebAdmin_VersionToBuild),
                UpgradeCode          = WebAdmin_UpgradeCode,
                AttributesDefinition = $"Id={Versions.WebAdmin_List.Single(_ => _.Key.ToString() == WebAdmin_VersionToBuild).Value};Manufacturer={manufacturer}",
                Description          = $"{WebAdmin_projectName},{manufacturer}",
                InstallScope         = InstallScope.perMachine,
                Properties           = new[]
                {
                    new Property("DATASOURCE", @"(LocalDb)\KL2"),
                    new Property("API_LOCATION", "http://*****:*****@"..\..\Assets\kl2_WebServices.ico";
            WebAdmin_project.MajorUpgrade = new MajorUpgrade
            {
                AllowSameVersionUpgrades = true,
                DowngradeErrorMessage    = "A later version of [ProductName] is already installed. Setup will now exit."
            };
            WebAdmin_project.WixVariables.Add("WixUILicenseRtf", "License.rtf");
            WebAdmin_project.DefaultDeferredProperties += "DATASOURCE=[DATASOURCE];API_LOCATION=[API_LOCATION];FILESERVER_LOCATION=[FILESERVER_LOCATION];";
            WebAdmin_project.BeforeInstall             += WebAdmin_Project_BeforeInstall;

            // Save the list of files to check integrity
            using (var writer = System.IO.File.CreateText("WebAdmin_FileList.txt"))
            {
                var rootCount = WebAdmin_scannAppDir.Files.First().Name.Split('\\').Length - 1;
                LogFiles(writer, rootCount, WebAdmin_scannAppDir);
            }

            WebAdmin_project.BuildWxs(Compiler.OutputType.MSI, "KL2WebAdmin_project.wxs");
            string WebAdmin_productMsi = WebAdmin_project.BuildMsi("KL²WebServices.msi");

            /////////////// BOOTSTRAPPER ///////////////
            var bootstrapper = new Bundle(projectName,
                                          new PackageGroupRef("NetFx471Redist"),
                                          new MsiPackage(API_productMsi)
            {
                Id            = "KL2_API_MSI",
                MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILESERVER_LOCATION=[FILESERVER_LOCATION];"
            },
                                          new MsiPackage(FileServer_productMsi)
            {
                Id            = "KL2_FILESERVER_MSI",
                MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILE_PROVIDER=[FILE_PROVIDER]; SERVER=[SERVER]; PORT=[PORT]; USER=[USER]; PASSWORD=[PASSWORD]; PUBLISHED_DIR=[PUBLISHED_DIR]; UPLOADED_DIR=[UPLOADED_DIR];"
            },
                                          new MsiPackage(Notification_productMsi)
            {
                Id            = "KL2_NOTIFICATION_MSI",
                MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; FILESERVER_LOCATION=[FILESERVER_LOCATION]; INTERVAL=[INTERVAL];"
            },
                                          new MsiPackage(WebAdmin_productMsi)
            {
                Id            = "KL2_WEBSERVICES_MSI",
                MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; DATASOURCE=[DATASOURCE]; API_LOCATION=[API_LOCATION]; FILESERVER_LOCATION=[FILESERVER_LOCATION];"
            })
            {
                Version                  = API_project.Version,
                Manufacturer             = manufacturer,
                UpgradeCode              = BootstrapperUpgradeCode,
                AboutUrl                 = @"http://www.k-process.com/",
                IconFile                 = @"..\..\Assets\kl2_Suite.ico",
                SuppressWixMbaPrereqVars = true,
                DisableModify            = "yes",
                Application              = new ManagedBootstrapperApplication(@"..\KProcess.KL2.Server.SetupUI\bin\Release\KProcess.KL2.Server.SetupUI.dll")
                {
                    Payloads = new[]
                    {
                        @"..\KProcess.KL2.Server.SetupUI\BootstrapperCore.config".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\BootstrapperCore.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\Microsoft.Deployment.WindowsInstaller.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\System.Windows.Interactivity.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\ControlzEx.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\MahApps.Metro.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\MahApps.Metro.IconPacks.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\Ookii.Dialogs.Wpf.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\Renci.SshNet.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\KProcess.KL2.ConnectionSecurity.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\FreshDeskLib.dll".ToPayload(),
                        @"..\KProcess.KL2.Server.SetupUI\bin\Release\Newtonsoft.Json.dll".ToPayload()
                    },
                    PrimaryPackageId = "KL2_API_MSI"
                }
            };

            bootstrapper.Variables = new[] {
                new Variable("DATASOURCE", @"(LocalDb)\KL2"),
                new Variable("API_LOCATION", "http://*****:*****@"C:\PublishedFiles"),
                new Variable("UPLOADED_DIR", @"C:\UploadedFiles")
            };
            bootstrapper.PreserveTempFiles   = true;
            bootstrapper.WixSourceGenerated += document =>
            {
                document.Root.Select("Bundle").Add(XDocument.Load("NET_Framework_Payload.wxs").Root.Elements());
                document.Root.Add(XDocument.Load("NET_Framework_Fragments.wxs").Root.Elements());
            };
            bootstrapper.Include(WixExtension.Util)
            .Include(WixExtension.Http);
            bootstrapper.Build(setupName);
        }
Beispiel #5
0
        private static string BuildMsiComServer()
        {
            Environment.SetEnvironmentVariable("ComServer",
                                               @"..\..\..\build\KSociety.Com.Srv.Host\Release\net5.0\publish");

            #region [Firewall]

            var serviceComServerFw = new FirewallException
            {
                Id            = "COM_SERVER_ID",
                Description   = "ComServer",
                Name          = "ComServer",
                IgnoreFailure = true,
                Profile       = FirewallExceptionProfile.all,
                Scope         = FirewallExceptionScope.any
            };

            #endregion

            #region [Feature]

            Feature binaries  = new Feature("Binaries", "Binaries", true, false);
            Feature comServer = new Feature("ComServer", "ComServer", true);

            binaries.Children.Add(comServer);

            #endregion

            File comService;

            Project project = new Project("ComServer",
                                          new Dir(new Id("INSTALLDIR"), @"%ProgramFiles%\" + Manufacturer + @"\" + Product,
                                                  new Dir(new Id("LOGSERVERDIR"), comServer, "Server",
                                                          new Files(comServer, @"%ComServer%\*.*", f => !f.Contains("KSociety.Com.Srv.Host.exe")),
                                                          comService = new File(comServer, @"%ComServer%\KSociety.Com.Srv.Host.exe", serviceComServerFw)
                                                          ) // LOGSERVER.
                                                  )         // INSTALLDIR.
                                          )
            {
                InstallScope     = InstallScope.perMachine,
                Platform         = Platform.x64,
                Version          = new Version("1.0.0.0"),
                GUID             = new Guid("8B826B78-29EE-49D0-B7E7-638B450DE4F5"),
                UI               = WUI.WixUI_ProgressOnly,
                ControlPanelInfo = new ProductInfo
                {
                    Manufacturer = Manufacturer
                }
            };

            comService.ServiceInstaller = new ServiceInstaller
            {
                Id                           = "COMSERVER",
                Name                         = Manufacturer + "." + Product + "Server",
                Description                  = Manufacturer + "." + Product + " - Server",
                StartOn                      = null,
                StopOn                       = SvcEvent.InstallUninstall_Wait,
                RemoveOn                     = SvcEvent.Uninstall_Wait,
                DelayedAutoStart             = true,
                ServiceSid                   = ServiceSid.none,
                RestartServiceDelayInSeconds = 30,
                ResetPeriodInDays            = 1,
                PreShutdownDelay             = 1000 * 60 * 3,
                RebootMessage                = "Failure actions do not specify reboot"
            };

            project.PreserveTempFiles = false;
            project.PreserveDbgFiles  = false;

            return(project.BuildMsi());
        }