Beispiel #1
0
    static public void Main(string[] args)
    {
        var project = new ManagedProject("ManagedSetup",
                                         new Dir(@"%ProgramFiles%\My Company\My Product",
                                                 new File(@"..\Files\bin\MyApp.exe"),
                                                 new Dir("Docs",
                                                         new File("readme.txt"),
                                                         new File(@"..\Files\Docs\tutorial.txt"))));

        project.ManagedUI            = ManagedUI.Default;
        project.ManagedUI.Icon       = "app.ico";
        project.MinimalCustomDrawing = true;

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

        project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";

        project.SetNetFxPrerequisite(Condition.Net45_Installed, "Please install .Net 4.5 First");

        // project.PreserveTempFiles = true;
        project.SourceBaseDir = @"..\..\";

        project.Localize();

        project.BuildMsi();
    }
Beispiel #2
0
        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));
        }
Beispiel #3
0
    static public void Main(string[] args)
    {
        if (Environment.GetEnvironmentVariable("APPVEYOR") != null)
        {
            return;
        }
        // Compiler.WixLocation = @"..\..\..\..\..\Wix_bin\bin";

        if (args.Contains("/test")) //for demo only
        {
            UIShell.Play(ManagedUI.Default.InstallDialogs);
            return;
        }

        //Note if the property 'PASSWORD' is not preserved as deferred then it will not be available
        //from the Project_AfterInstall, which is a deferred custom action.
        var project = new ManagedProject("ManagedSetup",
                                         new User
        {
            Name                 = Defaults.UserName,
            Password             = "******",
            Domain               = "[DOMAIN]",
            PasswordNeverExpires = true,
            CreateUser           = true
        },
                                         new Binary("CUSTOM_LNG".ToId(), "WixUI_fi-FI.wxl"),
                                         new Property("PASSWORD", "pwd123")
        {
            IsDeferred = true
        });

        project.SourceBaseDir = @"..\..\";
        project.GUID          = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
        //project.LocalizationFile = "MyProduct.en-us.wxl";
        project.LocalizationFile = "WixUI_de-de.wxl";
        project.Language         = "de-de";
        project.SetNetFxPrerequisite("NETFRAMEWORK35='#1'", "Please install .NET 3.5 first.");
        project.ManagedUI = new ManagedUI();
        project.ManagedUI.InstallDialogs.Add <WelcomeDialog>()
        .Add <MyProduct.UserNameDialog>()
        .Add <ProgressDialog>()
        .Add <ExitDialog>();

        //it effectively becomes a 'Repair' sequence
        project.ManagedUI.ModifyDialogs.Add <ProgressDialog>()
        .Add <ExitDialog>();

        project.UILoaded      += msi_UILoaded;
        project.BeforeInstall += msi_BeforeInstall;
        project.AfterInstall  += Project_AfterInstall;

        project.PreserveTempFiles = true;

        project.DefaultRefAssemblies.Add(@"C:\Users\oleg.shilo\source\repos\WindowsFormsApp2\WixSharp Setup1\bin\Debug\WpfControlLibrary2.dll");

        project.BuildMsi();
    }
Beispiel #4
0
    static public void Main(string[] args)
    {
        if (args.Contains("/test")) //for demo only
        {
            UIShell.Play(ManagedUI.Default.InstallDialogs);
            return;
        }

        //Note if the property 'PASSWORD' is not preserved as deferred then it will not be available
        //from the Project_AfterInstall, which is a deferred custom action.

        var project = new ManagedProject("ManagedSetup",
                                         new User
        {
            Name                 = Defaults.UserName,
            Password             = "******",
            Domain               = "[DOMAIN]",
            PasswordNeverExpires = true,
            CreateUser           = true
        },
                                         new Property("PASSWORD", "pwd123")
        {
            IsDeferred = true
        });

        project.SourceBaseDir = @"..\..\";
        project.GUID          = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
        //project.LocalizationFile = "MyProduct.en-us.wxl";
        project.LocalizationFile = "WixUI_de-de.wxl";
        project.Language         = "de-de";
        project.SetNetFxPrerequisite("NETFRAMEWORK35='#1'", "Please install .NET 3.5 first.");
        project.ManagedUI = new ManagedUI();
        project.ManagedUI.InstallDialogs.Add <WelcomeDialog>()
        .Add <MyProduct.UserNameDialog>()
        .Add <ProgressDialog>()
        .Add <ExitDialog>();

        //it effectively becomes a 'Repair' sequence
        project.ManagedUI.ModifyDialogs.Add <ProgressDialog>()
        .Add <ExitDialog>();

        project.UIInitialized += e =>
        {
            Debug.Assert(false);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(project.Language);
        };

        project.UILoaded      += msi_UILoaded;
        project.BeforeInstall += msi_BeforeInstall;
        project.AfterInstall  += Project_AfterInstall;

        project.PreserveTempFiles = true;

        project.BuildMsi();
    }
        static void Main()
        {
            var selectedExe = "MifareWindowsTool.exe";
            var solDir      = System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.IO.Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName).FullName).FullName).FullName + "\\MifareWindowsTool";
            var buildDir    = System.IO.Path.Combine(solDir, "bin\\Release");
            var project     = new ManagedProject("MifareWindowsTool",
                                                 new Dir(@"%ProgramFiles%\AVXTEC\MWT"
                                                         , new Files(buildDir + @"\*.*")));

            project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#461808'", "Please install .Net 4.7.2 First");
            project.ProductId = Guid.NewGuid();
            project.GUID      = new Guid("6fe30b47-2577-43ad-9095-1861ba25779b");
            project.ManagedUI = new ManagedUI();
            project.Name      = "MWT";
            project.ManagedUI.InstallDialogs
            .Add(Dialogs.InstallDir)
            .Add(Dialogs.Progress)
            .Add(Dialogs.Exit);

            project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
            .Add(Dialogs.Progress)
            .Add(Dialogs.Exit);
            var IconFilename = System.IO.Path.Combine(solDir, "MWT.ico");

            var desktopShortcut = new FileShortcut(selectedExe, "%Desktop%")
            {
                Name = "MWT"
            };
            var programMenuShortCut = new FileShortcut(selectedExe, @"%ProgramMenu%")
            {
                Name = $"MWT"
            };

            if (!string.IsNullOrWhiteSpace(IconFilename))
            {
                desktopShortcut.IconFile     = IconFilename;
                programMenuShortCut.IconFile = IconFilename;
            }
            project.ResolveWildCards(true)
            .FindFirstFile(selectedExe)
            .Shortcuts = new[] {
                desktopShortcut,
                programMenuShortCut
            };

            project.ControlPanelInfo.UrlInfoAbout = "https://github.com/xavave/Mifare-Windows-Tool";
            project.ControlPanelInfo.ProductIcon  = IconFilename;
            project.ControlPanelInfo.Contact      = "AVXTEC";
            project.ControlPanelInfo.Manufacturer = "AVXTEC";
            project.BuildMsi();
        }
Beispiel #6
0
        static void Main()
        {
            var project = new ManagedProject(Product,
                                             //new LaunchCondition("NETRELEASE>\"#461808\"", "Please install .NET 4.7.2+ first."),
                                             new Dir($@"%ProgramFiles%\{Company}\{Product}",
                                                     new File("Program.cs"))
                                             //,new RegValueProperty("NETRELEASE", RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", "0")
                                             );

            project.GUID              = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");
            project.Version           = ProductVersion;
            project.InstallPrivileges = InstallPrivileges.elevated;
            project.InstallScope      = InstallScope.perMachine;
            project.Platform          = Platform.x64;
            project.InstallerVersion  = 200;
            project.ScheduleReboot    = new ScheduleReboot();
            project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#4618080'", "Please install .NET 4.7.2+ first.");
            //custom set of standard UI dialogs
            project.ManagedUI = new ManagedUI();


            project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
//                                          .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 = "<input dir path>";
            //project.OutDir = "<output dir path>";

            project.BuildMsi();
        }
Beispiel #7
0
    static public void Main()
    {
        // optionally modify UAC related settings
        AutoElements.EnableUACRevealer = true;
        AutoElements.UACWarning        = "Wait for UAC prompt to appear on the taskbar.";

        var binaries = new Feature("Binaries", "Product binaries", true, false);
        var docs     = new Feature("Documentation", "Product documentation (manuals and user guides)", true)
        {
            Display = FeatureDisplay.expand
        };
        var tuts = new Feature("Tutorials", "Product tutorials", false)
        {
            Display = FeatureDisplay.expand
        };
        var manuals = new Feature("Manuals", "Product Manuals", false)
        {
            Display = FeatureDisplay.expand
        };
        var user_manuals = new Feature("User Manuals", "User Manuals", false);
        var dev_manuals  = new Feature("Developer Manuals", "Developer Manuals", false);

        docs.Children.Add(tuts);
        tuts.Children.Add(manuals);
        manuals.Children.Add(user_manuals);
        manuals.Children.Add(dev_manuals);

        var project = new ManagedProject("ManagedSetup",
                                         new Dir(@"%ProgramFiles%\My Company\My Product",
                                                 new File(binaries, @"..\Files\bin\MyApp.exe"),
                                                 new Dir("Docs",
                                                         new File(docs, "readme.txt"),
                                                         new File(tuts, @"..\Files\Docs\tutorial.txt"),
                                                         new File(user_manuals, @"..\Files\Docs\Manual.txt"),
                                                         new File(dev_manuals, @"..\Files\Docs\DevManual.txt"))));

        project.ManagedUI = new ManagedUI();

        //project.MinimalCustomDrawing = true;

        project.UIInitialized += CheckCompatibility; //will be fired on the embedded UI start
        project.Load          += CheckCompatibility; //will be fired on the MSI start

        //removing all entry dialogs and installdir
        project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
        // .Add(Dialogs.Licence) // decide if to show (or not) this dialog at runtime
        // .Add(Dialogs.Features)
        // .Add(Dialogs.SetupType)
        // .Add(Dialogs.InstallDir)
        .Add(Dialogs.Progress)
        .Add(Dialogs.Exit);

        //removing entry dialog
        project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
        .Add(Dialogs.Features)
        .Add(Dialogs.Progress)
        .Add(Dialogs.Exit);

        project.ManagedUI.Icon = "app.ico";
        project.UILoaded      += Project_UILoaded;

        project.MinimalCustomDrawing = true;

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

        project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";

        project.SetNetFxPrerequisite(Condition.Net45_Installed, "Please install .Net 4.5 First");

        project.PreserveTempFiles = true;
        project.SourceBaseDir     = @"..\..\";

        project.BuildMsi();
    }
Beispiel #8
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);
        }
Beispiel #9
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 #10
0
        private static ManagedProject CreateProject()
        {
            var binaryCode = new Feature("binary's", "My application binary's. This is mandatory of-course.", true, false);
            var registerDllInAutoCAD2019 = new Feature("Register AutoCAD 2019 dll.", "Check this if you want to register the dll to automatically load upon the launching of AutoCAD.", true, true);
            var registerDllInC3D2019     = new Feature("Register dll in C3D 2019.", "Check this if you want to register the dll to automatically load upon the launching of AutoCAD C3D.", true, true);

            // <Guid("1EB1D6F2-8704-4D6F-9BDE-83D07308D14F")>
            var project =
                new ManagedProject(productName,
                                   new InstallDir(binaryCode, productTargetInstallPath,
                                                  new WixSharp.File(@"readme.txt"),
                                                  new WixSharp.File(@"license.rtf"),
                                                  new Files(@"release\*.*"),
                                                  new File(new Id("ATL"), @"trustedlocations\AutocadTrustedLocations.exe"),
                                                  new File(@"trustedlocations\CommandLineArgumentsParser.dll"),
                                                  new File(@"trustedlocations\AutocadTrustedLocations.exe.config")
                                                  )
                                   )

                // Object initializer:
            {
                Name              = productName,
                OutFileName       = $"infrabel.topohelper.{Version}",
                Description       = productDescription,
                GUID              = new Guid(productGUID),
                Version           = Version,
                ControlPanelInfo  = CreateProductInfo(),
                InstallPrivileges = InstallPrivileges.limited,
                InstallScope      = InstallScope.perUser,
                SourceBaseDir     = sourcePathOfFiles,
                ReinstallMode     = "amus",
                LicenceFile       = @"license.rtf"
            };

            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize;
            project.PreserveTempFiles = false;
            project.UI = WUI.WixUI_Common;
            project.SetNetFxPrerequisite(Condition.Net46_Installed, ErrorMessageDotNet);
            project.AfterInstall  += Project_AfterInstall;
            project.BeforeInstall += Project_BeforeInstall;
            project.OutDir         = installerFolderPath;

            // Register application with autoCAD
            project.AddRegValues(
                //? AutoCAD 2019
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "LOADCTRLS", 14)
            {
                AttributesDefinition = typeInt
            },
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "LOADER", dllFinalPath),
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "MANAGED", 1)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "DESCRIPTION", productDescription),

                //? AutoCAD C3D 2019
                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "LOADCTRLS", 14)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "LOADER", dllFinalPath),

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "MANAGED", 1)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "DESCRIPTION", productDescription));

            return(project);
        }
        static void Main()
        {
            var project = new ManagedProject("WebchatBuilder",
                                             new RegValueProperty("IISMAJORVERSION", RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Services\W3SVC\Parameters", "MajorVersion", "0"),
                                             new LaunchCondition("Installed OR (IISMAJORVERSION AND IISMAJORVERSION >= \"#7\")", "IIS 7 or higher is required."),
                                             new Dir(@"%ProgramFiles%\Qsect\Webchat Builder",
                                                     //new Dir(@"D:\Qsect\Webchat Builder",
                                                     new Dir("WCB Service",
                                                     //new DirFiles(@"..\Release\Service\*.*", f => !f.EndsWith(".pdb") && !f.EndsWith(".obj"))),
                                                             new DirFiles(@"..\Release\Service_x86\*.*", f => !f.EndsWith(".pdb") && !f.EndsWith(".obj"))),
                                                     new Dir("WCB Web",
                                                             new Files(@"..\Release\Wcb\*.*", f => !f.EndsWith(".less") && !f.EndsWith(".map") && !f.EndsWith(".pdb") && !f.EndsWith(".obj")))))
            {
                GUID             = new Guid("e862184a-8bce-4281-bca9-d81242902fb0"),
                OutDir           = @"..\Build",
                LicenceFile      = @"..\Resources\Wcb-License.rtf",
                ControlPanelInfo = new ProductInfo
                {
                    ProductIcon  = @"..\Resources\icon.ico",
                    UrlInfoAbout = "https://qsect.com/webchatbuilder",
                    HelpLink     = "https://qsect.com/support",
                    Manufacturer = "Qsect LLC"
                },
                BackgroundImage  = @"..\Resources\SetupBackground.bmp",
                BannerImage      = @"..\Resources\SetupBanner.bmp",
                Version          = new Version("1.0.0.0"),
                LocalizationFile = "localization.wxl"
            };

            project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#378389'", "Please install the .Net Framework 4.5 first.");

            var service = project.ResolveWildCards().FindFile((f) => f.Name.EndsWith("WebChatBuilderService.exe")).First();

            service.ServiceInstaller = new ServiceInstaller
            {
                Name     = "Webchat Builder Service",
                StartOn  = SvcEvent.Install,
                StopOn   = SvcEvent.InstallUninstall_Wait,
                RemoveOn = SvcEvent.Uninstall_Wait,
            };

            project.ManagedUI = new ManagedUI();

            project.ManagedUI.InstallDialogs.Add <WelcomeDialog>()
            .Add <LicenceDialog>()
            .Add <WebSettingsDialog>()
            .Add <CicSettingsDialog>()
            .Add <SharedSettingsDialog>()
            .Add <LicenseKeyDialog>()
            .Add <ProgressDialog>()
            .Add <ExitDialog>();

            project.ManagedUI.ModifyDialogs.Add <MaintenanceTypeDialog>()
            .Add <ProgressDialog>()
            .Add <ExitDialog>();

            project.AfterInstall += project_AfterInstall;
            //project.PreserveTempFiles = true;
            project.DefaultDeferredProperties = "INSTALLDIR, UILevel, IIS_WEBSITENAME, IIS_POOL_NAME, WCB_DOMAIN, WCB_ALLOWED_DOMAINS, IIS_WEBSITEIPADDRESS, IIS_WEBSITEPORT, CIC_USER, CIC_PASS, CIC_PRIMARY, CIC_SECONDARY, CIC_PORT, CIC_PROTOCOL, WCB_LICENSE_KEY, WCB_PORT, WCB_CONNECTION_STRING";
            project.OutFileName = "WebchatBuilderSetup";
            project.BuildMsi();
        }
Beispiel #12
0
        static void Main()
        {
            var info        = XDocument.Load(@"wix\SetupInfo.wxi");
            var productName = info.Text("PRODUCT_NAME");
            var companyName = info.Text("COMPANY_NAME");
            var xllDirPath  = info.Text("XLL_DIR_PATH");
            var xll32       = info.Text("XLL32");
            var xll64       = info.Text("XLL64");
            var caOpenPath  = info.Text("CA_OPEN_PATH");

            var project = new ManagedProject(productName,
                                             new Dir($@"%ProgramFiles%\{companyName}\{productName}",
                                                     new File($@"{xllDirPath}\{xll32}"),
                                                     //new File($@"{xllDirPath}\{xll32}.config"),
                                                     new File($@"{xllDirPath}\{xll64}"),
                                                     //new File($@"{xllDirPath}\{xll64}.config"),
                                                     //new File($@"{xllDirPath}\License.lic"),
                                                     new File($@"{info.Text("CA_USER_FILE")}"),
                                                     new File($@"{info.Text("CA_MACH_FILE")}"),
                                                     new File($@"{caOpenPath}\{info.Text("CA_OPEN_FILE")}").Permanent(),
                                                     new File($@"{caOpenPath}\README.txt")),
                                             new Property("AddinFolder", "-")
                                             );

            project.AddXmlInclude(@"wix\SetupInfo.wxi");
            project.AddXmlInclude(@"wix\SetupScope.wxi");
            project.BackgroundImage                  = @"res\companySetupDialog.bmp";
            project.BannerImage                      = @"res\companySetupBanner.bmp";
            project.ControlPanelInfo.Comments        = "$(var.PRODUCT_DESC)";
            project.ControlPanelInfo.Readme          = "$(var.PRODUCT_SITE)/manual";
            project.ControlPanelInfo.HelpLink        = "$(var.PRODUCT_SITE)/support";
            project.ControlPanelInfo.UrlInfoAbout    = "$(var.PRODUCT_SITE)/about";
            project.ControlPanelInfo.UrlUpdateInfo   = "$(var.PRODUCT_SITE)/update";
            project.ControlPanelInfo.ProductIcon     = @"res\company.ico";
            project.ControlPanelInfo.Contact         = companyName;
            project.ControlPanelInfo.Manufacturer    = companyName;
            project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";
            project.ControlPanelInfo.NoModify        = true;

            //The combination of GUID and version will be seed for consistent ProductUpgradeCode and unique ProductId
            project.GUID = new Guid(info.Text("PRODUCT_GUID"));
            project.Include(WixExtension.Util);
            project.Language    = info.Text("SETUP_LANG");
            project.LicenceFile = @"res\product_License.rtf";

            //custom set of standard UI dialogs
            project.ManagedUI      = new ManagedUI();
            project.ManagedUI.Icon = @"res\company.ico";
            project.ManagedUI.InstallDialogs
            .Add(Dialogs.Welcome)
            .Add(Dialogs.Licence)
            .Add(Dialogs.InstallScope)
            .Add(Dialogs.Progress)
            .Add(Dialogs.Exit);
            project.ManagedUI.ModifyDialogs
            .Add(Dialogs.MaintenanceType)
            .Add(Dialogs.Progress)
            .Add(Dialogs.Exit);

            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.OutDir = @"..\Build\";
            project.SetVersionFromFile(info.Text("VER_DLL_FILE"));
            project.OutFileName = $"{productName}{project.Version}";
#if DEBUG
            project.PreserveTempFiles = true;
#endif
            project.SetNetFxPrerequisite("NETFRAMEWORK40FULL='#1'", $"{productName} requires .NET Framework 4.0.");
            project.UIInitialized          += Project_UIInitialized;
            project.ValidateBackgroundImage = false;
            project.BuildMsi();
        }