Exemplo n.º 1
0
        public InstallBuilder WithProgramMenuShortcut(string?fileName = null, string?arguments = "")
        {
            var formattableString = $"[INSTALLDIR]{fileName ?? _exeFileName}";
            var dir      = _project.FindDir(_programMenuPath);
            var shortcut = new ExeFileShortcut(_productName, formattableString, arguments);

            dir.Shortcuts = dir.Shortcuts.Combine(shortcut);
            return(this);
        }
Exemplo n.º 2
0
    public ServerInstaller(string version, string arch)
    {
        string upgradeGuid = "03E9476F-0F75-4661-BFC9-A9DAEB23D3A0";

        string[] binaries =
        {
            "mumble-server.exe",
            "Murmur.ice"
        };

        string[] licenses =
        {
            "qt.txt",
            "gpl.txt",
            "speex.txt",
            "lgpl.txt",
            "Mumble.rtf"
        };

        if (arch == "x64")
        {
            // 64 bit
            this.Platform = WixSharp.Platform.x64;
        }
        else if (arch == "x86")
        {
            // 32 bit
            this.Platform = WixSharp.Platform.x86;
        }

        this.Name                  = "Mumble Server";
        this.UpgradeCode           = Guid.Parse(upgradeGuid);
        this.Version               = new Version(version);
        this.OutFileName           = "mumble_server-" + this.Version + "-" + arch;
        this.Media.First().Cabinet = "Mumble.cab";

        var progsDir     = new Dir(@"%ProgramFiles%");
        var productDir   = new Dir("Mumble");
        var installDir   = new Dir("server");
        var licenseDir   = new Dir("licenses");
        var menuDir      = new Dir(@"%ProgramMenu%");
        var shortcutDir  = new Dir("Mumble");
        var menuShortcut = new ExeFileShortcut("Mumble Server", "[INSTALLDIR]mumble-server.exe", arguments: "");

        menuShortcut.IconFile = @"..\icons\murmur.ico";
        shortcutDir.Shortcuts = new ExeFileShortcut[] { menuShortcut };

        var binaryFiles  = new File[binaries.Length];
        var licenseFiles = new File[licenses.Length];

        for (int i = 0; i < binaries.Length; i++)
        {
            binaryFiles[i] = new File(@"..\..\" + binaries[i]);
        }

        for (int i = 0; i < licenses.Length; i++)
        {
            licenseFiles[i] = new File(@"..\..\licenses\" + licenses[i]);
        }

        installDir.Files = binaryFiles;
        licenseDir.Files = licenseFiles;

        menuDir.Dirs    = new Dir[] { shortcutDir };
        installDir.Dirs = new Dir[] { licenseDir };
        productDir.Dirs = new Dir[] { installDir };
        progsDir.Dirs   = new Dir[] { productDir };

        this.Dirs = new Dir[] {
            progsDir,
            menuDir
        };
    }
Exemplo n.º 3
0
    public ClientInstaller(string version, string arch, Features features)
    {
        string        upgradeGuid = "D269FC55-4F2C-4285-9AA9-4D034AF305C4";
        List <string> binaries    = new List <string>();

        string[] plugins =
        {
            "amongus.dll",
            "aoc.dll",
            "arma2.dll",
            "bf1.dll",
            "bf2.dll",
            "bf3.dll",
            "bf4.dll",
            "bf4_x86.dll",
            "bf1942.dll",
            "bf2142.dll",
            "bfbc2.dll",
            "bfheroes.dll",
            "blacklight.dll",
            "borderlands.dll",
            "borderlands2.dll",
            "breach.dll",
            "cod2.dll",
            "cod4.dll",
            "cod5.dll",
            "codmw2.dll",
            "codmw2so.dll",
            "cs.dll",
            "dys.dll",
            "etqw.dll",
            "ffxiv.dll",
            "ffxiv_x64.dll",
            "gmod.dll",
            "gtaiv.dll",
            "gtasa.dll",
            "gtav.dll",
            "gw.dll",
            "insurgency.dll",
            "jc2.dll",
            "link.dll",
            "lol.dll",
            "lotro.dll",
            "ql.dll",
            "rl.dll",
            "se.dll",
            "sr.dll",
            "ut3.dll",
            "ut99.dll",
            "ut2004.dll",
            "wolfet.dll",
            "wow.dll",
            "wow_x64.dll"
        };

        string[] licenses =
        {
            "qt.txt",
            "portaudio.txt",
            "gpl.txt",
            "speex.txt",
            "lgpl.txt",
            "Mumble.rtf"
        };

        if (arch == "x64")
        {
            // 64 bit
            this.Platform = WixSharp.Platform.x64;
            binaries      = new List <string>()
            {
                "celt0.0.7.0.dll",
                "opus.dll",
                "rnnoise.dll",
                "speex.dll",
                "mumble.exe",
                "mumble_app.dll",
            };

            if (features.overlay)
            {
                binaries.Add("mumble_ol.dll");
                binaries.Add("mumble_ol_helper.exe");
                binaries.Add("mumble_ol_helper_x64.exe");
                binaries.Add("mumble_ol_x64.dll");
            }

            if (features.g15)
            {
                binaries.Add("mumble-g15-helper.exe");
            }
        }
        else if (arch == "x86")
        {
            // 32 bit
            this.Platform = WixSharp.Platform.x86;
            binaries      = new List <string>()
            {
                "celt0.0.7.0.dll",
                "opus.dll",
                "rnnoise.dll",
                "speex.dll",
                "mumble.exe",
                "mumble_app.dll",
            };

            if (features.overlay)
            {
                binaries.Add("mumble_ol.dll");
                binaries.Add("mumble_ol_helper.exe");
            }

            if (features.g15)
            {
                binaries.Add("mumble-g15-helper.exe");
            }
        }

        this.Name                  = "Mumble (client)";
        this.UpgradeCode           = Guid.Parse(upgradeGuid);
        this.Version               = new Version(version);
        this.OutFileName           = "mumble_client-" + this.Version + "-" + arch;
        this.Media.First().Cabinet = "Mumble.cab";

        var progsDir     = new Dir(@"%ProgramFiles%");
        var productDir   = new Dir("Mumble");
        var installDir   = new Dir("client");
        var pluginDir    = new Dir("plugins");
        var licenseDir   = new Dir("licenses");
        var menuDir      = new Dir(@"%ProgramMenu%");
        var desktopDir   = new Dir(@"%Desktop%");
        var shortcutDir  = new Dir("Mumble");
        var menuShortcut = new ExeFileShortcut("Mumble", "[INSTALLDIR]mumble.exe", arguments: "");
        var deskShortcut = new ExeFileShortcut("Mumble", "[INSTALLDIR]mumble.exe", arguments: "");

        deskShortcut.IconFile = @"..\icons\mumble.ico";
        menuShortcut.IconFile = @"..\icons\mumble.ico";

        shortcutDir.Shortcuts = new ExeFileShortcut[] { menuShortcut };
        desktopDir.Shortcuts  = new ExeFileShortcut[] { deskShortcut };

        var binaryFiles  = new File[binaries.Count];
        var licenseFiles = new File[licenses.Length];
        var pluginFiles  = new File[plugins.Length];

        for (int i = 0; i < binaries.Count; i++)
        {
            if (binaries[i] == "mumble.exe")
            {
                binaryFiles[i] = new File(new Id("mumble.exe"), @"..\..\" + binaries[i], new FileAssociation("mumble_plugin", "application/mumble", "Open", "\"%1\""));
            }
            else
            {
                binaryFiles[i] = new File(@"..\..\" + binaries[i]);
            }
        }

        for (int i = 0; i < licenses.Length; i++)
        {
            licenseFiles[i] = new File(@"..\..\licenses\" + licenses[i]);
        }

        for (int i = 0; i < plugins.Length; i++)
        {
            pluginFiles[i] = new File(@"..\..\plugins\" + plugins[i]);
        }

        installDir.Files = binaryFiles;
        licenseDir.Files = licenseFiles;
        pluginDir.Files  = pluginFiles;

        menuDir.Dirs    = new Dir[] { shortcutDir };
        installDir.Dirs = new Dir[] { licenseDir, pluginDir };
        productDir.Dirs = new Dir[] { installDir };
        progsDir.Dirs   = new Dir[] { productDir };

        this.Dirs = new Dir[] {
            progsDir,
            menuDir,
            desktopDir
        };
        this.RegValues = new RegValue[] {
            new RegValue(RegistryHive.ClassesRoot, "mumble", "", "URL:Mumble"),
            new RegValue(RegistryHive.ClassesRoot, "mumble", "URL Protocol", ""),
            new RegValue(RegistryHive.ClassesRoot, @"mumble\DefaultIcon", "", "[#mumble.exe]"),
            new RegValue(RegistryHive.ClassesRoot, @"mumble\shell\open\command", "", "[#mumble.exe] \"%1\"")
        };
    }
Exemplo n.º 4
0
    public ClientInstaller(string version, string arch)
    {
        string upgradeGuid = "D269FC55-4F2C-4285-9AA9-4D034AF305C4";

        string[] binaries = null;
        string[] plugins  =
        {
            "amongus.dll",
            "aoc.dll",
            "arma2.dll",
            "bf1.dll",
            "bf2.dll",
            "bf3.dll",
            "bf4.dll",
            "bf4_x86.dll",
            "bf1942.dll",
            "bf2142.dll",
            "bfbc2.dll",
            "bfheroes.dll",
            "blacklight.dll",
            "borderlands.dll",
            "borderlands2.dll",
            "breach.dll",
            "cod2.dll",
            "cod4.dll",
            "cod5.dll",
            "codmw2.dll",
            "codmw2so.dll",
            "cs.dll",
            "dys.dll",
            "etqw.dll",
            "ffxiv.dll",
            "ffxiv_x64.dll",
            "gmod.dll",
            "gtaiv.dll",
            "gtasa.dll",
            "gtav.dll",
            "gw.dll",
            "insurgency.dll",
            "jc2.dll",
            "link.dll",
            "lol.dll",
            "lotro.dll",
            "ql.dll",
            "rl.dll",
            "se.dll",
            "sr.dll",
            "ut3.dll",
            "ut99.dll",
            "ut2004.dll",
            "wolfet.dll",
            "wow.dll",
            "wow_x64.dll"
        };

        string[] licenses =
        {
            "qt.txt",
            "portaudio.txt",
            "gpl.txt",
            "speex.txt",
            "lgpl.txt",
            "Mumble.rtf"
        };

        if (arch == "x64")
        {
            // 64 bit
            this.Platform = WixSharp.Platform.x64;
            binaries      = new string[] {
                "celt0.0.7.0.dll",
                "opus.dll",
                "rnnoise.dll",
                "speex.dll",
                "mumble.exe",
                "mumble_app.dll",
                "mumble_ol.dll",
                "mumble_ol_helper.exe",
                "mumble_ol_helper_x64.exe",
                "mumble_ol_x64.dll"
            };
        }
        else if (arch == "x86")
        {
            // 32 bit
            this.Platform = WixSharp.Platform.x86;
            binaries      = new string[] {
                "celt0.0.7.0.dll",
                "opus.dll",
                "rnnoise.dll",
                "speex.dll",
                "mumble.exe",
                "mumble_app.dll",
                "mumble_ol.dll",
                "mumble_ol_helper.exe"
            };
        }

        this.Name                  = "Mumble (client)";
        this.UpgradeCode           = Guid.Parse(upgradeGuid);
        this.Version               = new Version(version);
        this.OutFileName           = "mumble_client-" + this.Version + "-" + arch;
        this.Media.First().Cabinet = "Mumble.cab";

        var progsDir     = new Dir(@"%ProgramFiles%");
        var productDir   = new Dir("Mumble");
        var installDir   = new Dir("client");
        var pluginDir    = new Dir("plugins");
        var licenseDir   = new Dir("licenses");
        var menuDir      = new Dir(@"%ProgramMenu%");
        var desktopDir   = new Dir(@"%Desktop%");
        var shortcutDir  = new Dir("Mumble");
        var menuShortcut = new ExeFileShortcut("Mumble", "[INSTALLDIR]mumble.exe", arguments: "");
        var deskShortcut = new ExeFileShortcut("Mumble", "[INSTALLDIR]mumble.exe", arguments: "");

        deskShortcut.IconFile = @"..\icons\mumble.ico";
        menuShortcut.IconFile = @"..\icons\mumble.ico";

        shortcutDir.Shortcuts = new ExeFileShortcut[] { menuShortcut };
        desktopDir.Shortcuts  = new ExeFileShortcut[] { deskShortcut };

        var binaryFiles  = new File[binaries.Length];
        var licenseFiles = new File[licenses.Length];
        var pluginFiles  = new File[plugins.Length];

        for (int i = 0; i < binaries.Length; i++)
        {
            binaryFiles[i] = new File(@"..\..\" + binaries[i]);
        }

        for (int i = 0; i < licenses.Length; i++)
        {
            licenseFiles[i] = new File(@"..\..\licenses\" + licenses[i]);
        }

        for (int i = 0; i < plugins.Length; i++)
        {
            pluginFiles[i] = new File(@"..\..\plugins\" + plugins[i]);
        }

        installDir.Files = binaryFiles;
        licenseDir.Files = licenseFiles;
        pluginDir.Files  = pluginFiles;

        menuDir.Dirs    = new Dir[] { shortcutDir };
        installDir.Dirs = new Dir[] { licenseDir, pluginDir };
        productDir.Dirs = new Dir[] { installDir };
        progsDir.Dirs   = new Dir[] { productDir };

        this.Dirs = new Dir[] {
            progsDir,
            menuDir,
            desktopDir
        };
    }
Exemplo n.º 5
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.º 6
0
        public void BuildMsi()
        {
            Log.Logger = StandardLoggerConfigurator
                         .GetLoggerConfig()
                         .CreateLogger();

            try
            {
                Log.Logger.Debug(@"Building MSI...");

                IMsiBuilderSettings msiBuilderSettings = new MsiBuilderSettings();

                var pathChoices = msiBuilderSettings.PathChoices;
                var uiExe       = msiBuilderSettings.UiExe;

                Log.Logger.Debug(@"Creating installer for: " + uiExe);

                var path = pathChoices.FirstOrDefault(x => File.Exists(x + @"\" + uiExe));
                if (string.IsNullOrEmpty(path))
                {
                    throw new ArgumentException("The uiExe was not found: " + uiExe);
                }

                Log.Logger.Debug(@"Chosen path: " + path);

                var guidString = GetGuidString();

                var envStringToShow = GetEnvStringToShow(msiBuilderSettings);
                var releaseNumber   = msiBuilderSettings.ReleaseNumber;

                Log.Logger.Debug(@"Release number is: " + releaseNumber);

                var companyName    = msiBuilderSettings.CompanyName;
                var productWithEnv = msiBuilderSettings.ProductName + $"{envStringToShow}";

                Log.Logger.Debug(@"Product with env is: " + productWithEnv);

                var x64SqLite = new Feature("x64SqLite");
                var x86SqLite = new Feature("x86SqLite");

                //var exeFileShortcut1 = new ExeFileShortcut(productWithEnv,
                //    $@"%ProgramFiles%\\{companyName}\\{productWithEnv}\\JCI.ITC.SABPrice.UI.exe",
                //    "");
                var exeFileShortcut1 = new ExeFileShortcut(productWithEnv,
                                                           $@"[INSTALLDIR]\\" + msiBuilderSettings.UiExe,
                                                           "");
                var exeFileShortcut2 = new ExeFileShortcut($"Uninstall {productWithEnv}", "[System64Folder]msiexec.exe",
                                                           "/x [ProductCode]");
                var menuDir = new Dir(
                    $"%ProgramMenu%\\{companyName}\\{productWithEnv}",
                    exeFileShortcut1,
                    exeFileShortcut2);

                const string appIconName = "app_icon.ico";
                if (!File.Exists(appIconName))
                {
                    throw new ArgumentException("No app icon file found named : " + appIconName);
                }


                var msiPrefix = msiBuilderSettings.MsiPrefix;
                var project   = new Project(
                    $"{productWithEnv} {releaseNumber}",
                    new Dir(
                        $@"%ProgramFiles%\{companyName}\{productWithEnv}",
                        new Files(path + @"\*.*",
                                  f => !f.EndsWith(".pdb") && !f.EndsWith(".msi")
                                  )
                        //,new Files(x64SqLite, path + @"\x64\SQLite.Interop.dll")
                        //,new Files(x86SqLite, path + @"\x86\SQLite.Interop.dll")
                        ),
                    menuDir
                    )
                {
                    GUID                 = new Guid(guidString),
                    OutFileName          = $@".\{msiPrefix}{envStringToShow}.{releaseNumber}",
                    MajorUpgradeStrategy = MajorUpgradeStrategy.Default,
                    Version              = new Version(releaseNumber),
                    ControlPanelInfo     = { ProductIcon = appIconName }
                };

                var exe = project
                          .ResolveWildCards()
                          .FindFile(f => f.Name.EndsWith(uiExe))
                          .First();

                exe.Shortcuts = new[]
                {
                    new FileShortcut(productWithEnv, "%Desktop%")
                };

                project.Version = new Version(releaseNumber);

                project.ControlPanelInfo.Comments        = productWithEnv;
                project.ControlPanelInfo.Readme          = "https://jci.com/";
                project.ControlPanelInfo.HelpLink        = "https://jci.com/";
                project.ControlPanelInfo.HelpTelephone   = "(+45) 6170 8335";
                project.ControlPanelInfo.UrlInfoAbout    = "https://jci.com/";
                project.ControlPanelInfo.UrlUpdateInfo   = "https://jci.com/";
                project.ControlPanelInfo.ProductIcon     = appIconName;
                project.ControlPanelInfo.Contact         = "*****@*****.**";
                project.ControlPanelInfo.Manufacturer    = "Sabroe Factory by Johnson Controls";
                project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";
                project.ControlPanelInfo.NoModify        = true;
                //project.ControlPanelInfo.NoRepair = true,
                //project.ControlPanelInfo.NoRemove = true,
                //project.ControlPanelInfo.SystemComponent = true, //if set will not be shown in Control Panel


                project.BannerImage     = "TopBanner.bmp";
                project.BackgroundImage = "MainPage.bmp";

                Log.Logger.Debug(@"BuildMSI ");
                Compiler.BuildMsi(project);

                Log.Logger.Debug(@"Succesfully created ");
                Log.Logger.Debug(project.Name);
            }
            catch (Exception e)
            {
                Log.Logger.Error(e, "During Setup / MSI creation.");
                Environment.ExitCode = 1;
                throw;
            }
        }
Exemplo n.º 7
0
        static void Main()
        {
            // This project type has been superseded with the EmbeddedUI based "WixSharp Managed Setup - Custom Dialog"
            // project type. Which provides by far better final result and user experience.
            // However due to the Burn limitations (see this discussion: https://wixsharp.codeplex.com/discussions/645838)
            // currently "Custom CLR Dialog" is the only working option for having bootstrapper silent UI displaying
            // individual MSI packages UI implemented in managed code.

            var uninstallerShortcut = new ExeFileShortcut("Uninstall LANraragi", "[System64Folder]msiexec.exe", "/x [ProductCode]");

            var project = new Project("LANraragi",
                                      new Dir(@"%AppData%\LANraragi",
                                              new Files(@"..\Karen\bin\x64\Release\*.*"),
                                              new File(@"..\External\package.tar"),
                                              new Dir("LxRunOffline",
                                                      new Files(@"..\External\LxRunOffline\*.*")),
                                              uninstallerShortcut
                                              ),
                                      new Dir(@"%ProgramMenu%\LANraragi for Windows",
                                              new ExeFileShortcut("LANraragi", "[INSTALLDIR]Karen.exe", ""),
                                              new ExeFileShortcut("Uninstall LANraragi", "[System64Folder]msiexec.exe", "/x [ProductCode]")),
                                      new RegValue(RegistryHive.LocalMachineOrUsers, @"Software\Microsoft\Windows\CurrentVersion\Run", "Karen", "[INSTALLDIR]Karen.exe"),
                                      new ManagedAction(RegisterWslDistro,
                                                        Return.check,
                                                        When.After,
                                                        Step.InstallFinalize,
                                                        Condition.NOT_BeingRemoved),
                                      new ManagedAction(UnRegisterWslDistro,
                                                        Return.check,
                                                        When.Before,
                                                        Step.RemoveFiles,
                                                        Condition.BeingUninstalled)
                                      );

            project.GUID         = new Guid("6fe30b47-2577-43ad-1337-1861ba25889b");
            project.Platform     = Platform.x64;
            project.MajorUpgrade = new MajorUpgrade
            {
                Schedule = UpgradeSchedule.afterInstallValidate, // Remove previous version entirely before reinstalling, so that the WSL distro isn't uninstall on upgrade.
                DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit."
            };

            // Version number is based on the LRR_VERSION_NUM env variable
            var version = "0.0.1";

            if (Environment.GetEnvironmentVariable("LRR_VERSION_NUM") != null)
            {
                version = Environment.GetEnvironmentVariable("LRR_VERSION_NUM");
            }

            try
            {
                project.Version = Version.Parse(version.Replace("-EX", ".38")); //dotnet versions don't accept text or dashes but I ain't about to f**k up my versioning schema dagnabit
            }
            catch
            {
                Console.WriteLine("Couldn't get version from the environment variable " + version);
                project.Version = Version.Parse("0.0.1");
            }

            // Check for x64 Windows 10
            project.LaunchConditions.Add(new LaunchCondition("VersionNT64", "LANraragi for Windows can only be installed on a 64-bit Windows."));
            project.LaunchConditions.Add(new LaunchCondition("VersionNT>=\"603\"", "LANraragi for Windows can only be installed on Windows 10 and up."));

            //Schedule custom dialog between WelcomeDlg and InstallDirDlg standard MSI dialogs.
            project.InjectClrDialog(nameof(ShowDialogIfWslDisabled), NativeDialogs.WelcomeDlg, NativeDialogs.InstallDirDlg);

            //remove LicenceDlg
            project.RemoveDialogsBetween(NativeDialogs.InstallDirDlg, NativeDialogs.VerifyReadyDlg);

            // Customize
            project.BackgroundImage = @"Images\dlgbmp.bmp";
            project.BannerImage     = @"Images\bannrbmp.bmp";

            project.ControlPanelInfo.UrlInfoAbout  = "https://github.com/Difegue/LANraragi";
            project.ControlPanelInfo.UrlUpdateInfo = "https://sugoi.gitbook.io/lanraragi/";
            project.ControlPanelInfo.ProductIcon   = @"Images\favicon.ico";
            project.ControlPanelInfo.Contact       = "Difegue";
            project.ControlPanelInfo.Manufacturer  = "Difegue";

            project.OutDir = "bin";
            project.BuildMsi();
        }