Exemplo n.º 1
0
    static public void Main1()
    {
        var project = new ManagedProject("IsUninstallTest",
                                         new Dir(@"%ProgramFiles%\UninstallTest",
                                                 new File(@"files\setup.cs")));

        project.AfterInstall     += Project_AfterInstall;
        project.PreserveTempFiles = true;
        project.BuildWxs();
    }
Exemplo n.º 2
0
        static void Main()
        {
            var someTool      = new Feature("SomeTool", true, true);
            var someOtherTool = new Feature("SomeOtherTool", true, true);
            var mainApp       = new Feature("MainApp", true, false);

            var project = new ManagedProject("MyProduct",
                                             new ElevatedManagedAction(CustomActions.Install, Return.check, When.After, Step.InstallFiles, Condition.NOT_Installed, CustomActions.Rollback)
            {
                UsesProperties = "Prop=Install",                         // need to tunnel properties since ElevatedManagedAction is a deferred action
                RollbackArg    = "Prop=Rollback"
            },
                                             new Binary(new Id("MyCertificateFile"), @"Certificate\certificate.p12"),
                                             new Certificate("MyCertificate", StoreLocation.localMachine, StoreName.personal, "MyCertificateFile"),
                                             new Dir("%ProgramFiles%",
                                                     new InstallDir("My Product", new DirFiles(mainApp, @"..\WixSharpPlayground\bin\Debug\*.*", f => !f.EndsWith(".pdb")), new DirPermission("Everyone", GenericPermission.All),
                                                                    new Dir("SomeTool", new DirFiles(someTool, @"..\SomeTool\bin\Debug\*.*", f => !f.EndsWith(".pdb")), new DirPermission("Everyone", GenericPermission.All)),
                                                                    new Dir("SomeOtherTool", new DirFiles(someOtherTool, @"..\SomeOtherTool\bin\Debug\*.*", f => !f.EndsWith(".pdb")), new DirPermission("Everyone", GenericPermission.All))
                                                                    )));

            project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");

            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(Dialogs.Licence)
            .Add(Dialogs.SetupType)
            .Add(Dialogs.Features)
            .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.SourceBaseDir = ".";
            //project.OutDir = "<output dir path>";



            project.BuildWxs();
            project.BuildMsi();
            Compiler.BuildMsi(project);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var projectName = $"{appName} v{ToCompactVersionString(Version.Parse(VersionToBuild))}";

            //WriteLicenseRtf();

            Compiler.LightOptions = "-sice:ICE57";

            /////////////// KL² MSI ///////////////
            ExeFileShortcut desktopShortcut = new ExeFileShortcut(appName, @"[INSTALLDIR]KL².exe", "")
            {
                Condition = "INSTALLDESKTOPSHORTCUT=\"yes\""
            };
            ExeFileShortcut startMenuLaunchShortcut = new ExeFileShortcut(appName, @"[INSTALLDIR]KL².exe", "")
            {
                Condition = "INSTALLSTARTMENUSHORTCUT=\"yes\""
            };
            ExeFileShortcut startMenuUninstallShortcut = new ExeFileShortcut($"Uninstall {appName}", $@"[AppDataFolder]\Package Cache\[BUNDLE_ID]\{setupName}", "/uninstall")
            {
                WorkingDirectory = "AppDataFolder", Condition = "INSTALLSTARTMENUSHORTCUT =\"yes\" AND BUNDLE_ID <> \"[BUNDLE_ID]\""
            };
            Dir scanAppDir = ScanFiles("KL2VideoAnalyst",
                                       System.IO.Path.GetFullPath(@"..\KL2-Core\KProcess.Ksmed.Presentation.Shell\bin\Release"),
                                       (file) => file.EndsWith(".pdb") || file.EndsWith(".xml") || file.EndsWith(".vshost.exe") || file.EndsWith(".vshost.exe.config") || file.EndsWith(".vshost.exe.manifest"));
            //scannAppDir.AddDir(new Dir("Extensions"));

            /*scannAppDir.AddDir(new Dir("ExportBuffer",
             *                          new Dir("SQL")
             *                          {
             *                              Permissions = new DirPermission[]
             *                          {
             *                              new DirPermission("Users", GenericPermission.All),
             *                              new DirPermission("NetworkService", GenericPermission.All)
             *                          }
             *                          }));*/
            Dir desktopDir   = new Dir("%DesktopFolder%", desktopShortcut);
            Dir startMenuDir = new Dir($@"%ProgramMenuFolder%\{manufacturer}", startMenuLaunchShortcut, startMenuUninstallShortcut);

            RegValue installReg           = new RegValue(RegistryHive.LocalMachine, regKey, "InstallLocation", "[INSTALLDIR]");
            RegValue desktopShortcutReg   = new RegValue(RegistryHive.LocalMachine, regKey, "DesktopShortcut", "[INSTALLDESKTOPSHORTCUT]");
            RegValue startMenuShortcutReg = new RegValue(RegistryHive.LocalMachine, regKey, "StartMenuShortcut", "[INSTALLSTARTMENUSHORTCUT]");

            ManagedAction editConfig = new ManagedAction(CustomActions.EditConfig, Return.check, When.After, Step.InstallFinalize, WixSharp.Condition.NOT_Installed);

            var project = new ManagedProject(projectName, scanAppDir, desktopDir, startMenuDir, installReg, desktopShortcutReg, startMenuShortcutReg, editConfig)
            {
                GUID                 = Versions.List.Single(_ => _.Key.ToString() == VersionToBuild).Value,
                Version              = Version.Parse(VersionToBuild),
                UpgradeCode          = UpgradeCode,
                AttributesDefinition = $"Id={Versions.List.Single(_ => _.Key.ToString() == VersionToBuild).Value};Manufacturer={manufacturer}",
                Description          = $"{projectName},{manufacturer}",
                InstallScope         = InstallScope.perMachine,
                Properties           = new[]
                {
                    new Property("LANGUAGE", "en-US"),
                    new Property("INSTALLDESKTOPSHORTCUT", "yes"),
                    new Property("INSTALLSTARTMENUSHORTCUT", "yes"),
                    new Property("API_LOCATION", ""),
                    new Property("FILESERVER_LOCATION", ""),
                    new Property("SYNCPATH", "[INSTALLDIR]\\SyncFiles"),
                    new Property("SENDREPORT", "yes"),
                    new Property("MUTE", "no"),
                    new Property("BUNDLE_ID", "[BUNDLE_ID]")
                }
            };

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

            // Save the list of files to check integrity
            void LogFiles(System.IO.StreamWriter writer, int rootCount, Dir root)
            {
                foreach (var file in root.Files)
                {
                    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("VideoAnalyst_FileList.txt"))
            {
                var rootCount = scanAppDir.Files.First().Name.Split('\\').Length - 1;
                LogFiles(writer, rootCount, scanAppDir);
            }

            project.BuildWxs(Compiler.OutputType.MSI, "KL2_project.wxs");
            string productMsi = project.BuildMsi("KL²VideoAnalyst.msi");

            /////////////// BOOTSTRAPPER ///////////////
            var bootstrapper = new Bundle(projectName,
                                          new PackageGroupRef("NetFx471Redist"),
                                          new MsiPackage(productMsi)
            {
                Id            = "KL2VIDEOANALYST_MSI",
                MsiProperties = $"BUNDLE_ID=[WixBundleProviderKey]; INSTALLDIR=[INSTALLDIR]; LANGUAGE=[LANGUAGE]; INSTALLDESKTOPSHORTCUT=[INSTALLDESKTOPSHORTCUT]; INSTALLSTARTMENUSHORTCUT=[INSTALLSTARTMENUSHORTCUT]; API_LOCATION=[API_LOCATION]; FILESERVER_LOCATION=[FILESERVER_LOCATION]; SYNCPATH=[SYNCPATH]; SENDREPORT=[SENDREPORT]; MUTE=[MUTE];"
            })
            {
                Version                  = project.Version,
                Manufacturer             = manufacturer,
                UpgradeCode              = BootstrapperUpgradeCode,
                AboutUrl                 = @"http://www.k-process.com/",
                IconFile                 = @"..\..\Assets\kl2_VideoAnalyst.ico",
                SuppressWixMbaPrereqVars = true,
                DisableModify            = "yes",
                Application              = new ManagedBootstrapperApplication(@"..\KProcess.KL2.SetupUI\bin\Release\KProcess.KL2.SetupUI.dll")
                {
                    Payloads = new[]
                    {
                        @"..\KProcess.KL2.SetupUI\BootstrapperCore.config".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\BootstrapperCore.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\Microsoft.Deployment.WindowsInstaller.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\System.Windows.Interactivity.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\ControlzEx.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\MahApps.Metro.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\MahApps.Metro.IconPacks.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\WPF.Dialogs.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\KProcess.KL2.ConnectionSecurity.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\FreshDeskLib.dll".ToPayload(),
                        @"..\KProcess.KL2.SetupUI\bin\Release\Newtonsoft.Json.dll".ToPayload()
                    },
                    PrimaryPackageId = "KL2VIDEOANALYST_MSI"
                }
            };

            bootstrapper.Variables = new[] {
                new Variable("MSIINSTALLPERUSER", "0"),
                new Variable("INSTALLDIR", "dummy"),
                new Variable("INSTALLDESKTOPSHORTCUT", "yes"),
                new Variable("INSTALLSTARTMENUSHORTCUT", "yes"),
                new Variable("API_LOCATION", "http://*****:*****@".\SyncFiles"),
                new Variable("SENDREPORT", "yes"),
                new Variable("MUTE", "no"),
                new Variable("LANGUAGE", "en-US")
            };
            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);
            bootstrapper.Build(setupName);
        }
Exemplo n.º 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);
        }