Build() public method

Builds WiX Bootstrapper application from the specified Bundle project instance.
public Build ( string path = null ) : string
path string The path to the bootstrapper to be build.
return string
Ejemplo n.º 1
0
    //The UI implementation is based on the work of BRYANPJOHNSTON
    //http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/
    public static void Main(string[] args)
    {
        var productProj =
            new Project("My Product",
                new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("readme.txt"))) { InstallScope = InstallScope.perMachine };

        productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777");
        string productMsi = productProj.BuildMsi();

        //------------------------------------

        var bootstrapper =
                new Bundle("My Product",
                    new PackageGroupRef("NetFx40Web"),
                    new MsiPackage(productMsi) { Id = "MyProductPackageId" });

        bootstrapper.Version = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%"); // you can also use System.Reflection.Assembly.GetExecutingAssembly().Location

        bootstrapper.PreserveTempFiles = true;

        bootstrapper.Build();

        //io.File.Delete(productMsi);
    }
Ejemplo n.º 2
0
    public static void Main(string[] args)
    {
        var productProj =
            new Project("My Product",
                new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("readme.txt"))) { InstallScope = InstallScope.perMachine };

        productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777");
        productProj.LicenceFile = "License.rtf";
        string productMsi = productProj.BuildMsi();

        var bootstrapper =
                new Bundle("My Product Suite",
                    new PackageGroupRef("NetFx40Web"),
                    new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = true });

        bootstrapper.Version = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889c");
        bootstrapper.Application = new SilentBootstrapperApplication();

        //use this custom BA to modify it's behavior to meet your requirements
        //bootstrapper.Application = new ManagedBootstrapperApplication("%this%");

        bootstrapper.PreserveTempFiles = true;
        bootstrapper.Build();
    }
Ejemplo n.º 3
0
    public static void Main(string[] args)
    {
        var productProj =
            new Project("My Product",
                new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("readme.txt")))
            { InstallScope = InstallScope.perUser };
        //---------------------------------------------------------
        var crtProj =
            new Project("CRT",
                new Dir(@"%ProgramFiles%\My Company\CRT",
                    new File("readme.txt")))
            { InstallScope = InstallScope.perUser };

        //---------------------------------------------------------
        string productMsi = productProj.BuildMsi();
        string crtMsi = crtProj.BuildMsi();
        //---------------------------------------------------------

        var bootstrapper =
                new Bundle("My Product",
                    new PackageGroupRef("NetFx40Web"),
                    new MsiPackage(crtMsi) { DisplayInternalUI = true },
                    new MsiPackage(productMsi) { DisplayInternalUI = true });

        bootstrapper.AboutUrl = "https://wixsharp.codeplex.com/";
        bootstrapper.IconFile = "app_icon.ico";
        bootstrapper.Version = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b");
        bootstrapper.Application.LogoFile = "logo.png";
        bootstrapper.Application.LicensePath = "licence.html";  //HyperlinkLicense app with embedded license file
        //bootstrapper.Application.LicensePath = "licence.rtf"; //RtfLicense app with embedded license file
        //bootstrapper.Application.LicensePath = "http://opensource.org/licenses/MIT"; //HyperlinkLicense app with online license file
        //bootstrapper.Application.LicensePath = null; //HyperlinkLicense app with no license

        bootstrapper.PreserveTempFiles = true;
        bootstrapper.Build();
        //---------------------------------------------------------

        //if (io.File.Exists(productMsi))
          //  io.File.Delete(productMsi);

        if (io.File.Exists(crtMsi))
            io.File.Delete(crtMsi);
    }
Ejemplo n.º 4
0
    static public void Main(string[] args)
    {
        var productProj =
            new Project("My Product",
                new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("readme.txt"))) { InstallScope = InstallScope.perUser };
        
        productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258777");
        string productMsi = productProj.BuildMsi();

        var bootstrapper =
                new Bundle("My Product",
                    new PackageGroupRef("NetFx40Web"),
                    new MsiPackage(productMsi) { DisplayInternalUI = true });

        bootstrapper.Version = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b");
        bootstrapper.Application = new SilentBootstrapperApplication();

        bootstrapper.PreserveTempFiles = true;
        bootstrapper.Build();
    }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            Feature appFeature = new Feature("Application files", "Main application files", true, false, @"INSTALLDIR");
            var shortcut = new FileShortcut(appFeature, "digiCamControl", @"%ProgramMenu%\digiCamControl") { WorkingDirectory = @"INSTALLDIR" };
            var shortcutD = new FileShortcut(appFeature, "digiCamControl", @"%Desktop%") { WorkingDirectory = @"INSTALLDIR" };
            var appDir = new Dir(@"digiCamControl",
                new File(appFeature, "CameraControl.exe", shortcut, shortcutD),
                new File(appFeature, "CameraControl.PluginManager.exe"),
                new File(appFeature, "CameraControlCmd.exe"),
                new File(appFeature, "CameraControlRemoteCmd.exe"),
                new File(appFeature, "dcraw.exe"),
                new File(appFeature, "ffmpeg.exe"),
                new File(appFeature, "ngrok.exe"),
                new File(appFeature, "MtpTester.exe"),
                //new File(appFeature, "PhotoBooth.exe",new FileShortcut(appFeature, "PhotoBooth", @"%ProgramMenu%\digiCamControl")),
                new DirFiles(appFeature, @"*.dll"),
            #if DEBUG
                new DirFiles(appFeature, @"*.pdb"),
            #endif
                new File(appFeature, "regwia.bat"),
                new File(appFeature, "logo.ico"),
                new File(appFeature, "logo_big.jpg"),
                new File(appFeature, "baseMtpDevice.xml"),
                new DirFiles(appFeature, @"*.png"),
                new File(appFeature, "DigiCamControl.xbs"),
                new Dir(appFeature, "Data",
                    new Files(appFeature, @"Data\*.*")),
                //new Dir(appFeature, "Plugins",
                //    new Files(appFeature, @"Plugins\*.*", "MahApps.Metro.*", "System.Windows.Interactivity.*",
                //        "WriteableBitmapEx.Wpf.*", "GalaSoft.MvvmLight.*", "*.config")),
                new Dir(appFeature, "Plugins",
                    new Dir(appFeature, "CameraControl.Plugins",
                        new File(appFeature, "Plugins\\CameraControl.Plugins\\CameraControl.Plugins.dll"),
                        new File(appFeature, "Plugins\\CameraControl.Plugins\\dcc.plugin")),
                    new Dir(appFeature, "Plugin.DeviceControlBox",
                        new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\Plugin.DeviceControlBox.dll"),
                        new File(appFeature, "Plugins\\Plugin.DeviceControlBox\\dcc.plugin"))
                    ),
                new Dir(appFeature, "Languages",
                    new DirFiles(appFeature, @"Languages\*.xml")),
                new Dir(appFeature, "Licenses",
                    new DirFiles(appFeature, @"Licenses\*.*")),
                new Dir(appFeature, "x64",
                    new DirFiles(appFeature, @"x64\*.*")),
                new Dir(appFeature, "x86",
                    new DirFiles(appFeature, @"x86\*.*")),
                new Dir(appFeature, "Tools",
                    new DirFiles(appFeature, @"Tools\*.*")),
                new Dir(appFeature, "WebServer",
                    new Files(appFeature, @"WebServer\*.*"))
                );

            var baseDir = new Dir(@"%ProgramFiles%",
                appDir
                );

            Project project = new Project("digiCamControl",
                baseDir,
                new ManagedAction(Setup.CustomActions.MyAction, Return.ignore, When.Before, Step.InstallExecute,
                    Condition.NOT_Installed, Sequence.InstallExecuteSequence),
                new ManagedAction(Setup.CustomActions.SetRightAction, Return.ignore, When.Before, Step.InstallFinalize,
                    Condition.Always, Sequence.InstallExecuteSequence),
                new RegValue(appFeature, RegistryHive.ClassesRoot,
                    @"Wow6432Node\CLSID\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\Instance\{628C6DCD-6A0A-4804-AAF3-91335A83239B}",
                    "FriendlyName",
                    "digiCamControl Virtual WebCam"),
                new RegValue(appFeature, RegistryHive.CurrentUser,
                    @"SOFTWARE\IP Webcam",
                    "url",
                    "http://*****:*****@"SOFTWARE\IP Webcam",
                    "width","640"),
                new RegValue(appFeature, RegistryHive.CurrentUser,
                    @"SOFTWARE\IP Webcam",
                    "height", "426")
                );

            project.UI = WUI.WixUI_InstallDir;
            project.GUID = new Guid("19d12628-7654-4354-a305-9ab0932af676");
            //project.SetNetFxPrerequisite("NETFRAMEWORK45='#1'");

            #if DEBUG
            project.SourceBaseDir =
                Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\"));
            #else
            project.SourceBaseDir =
                Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\"));
            #endif
            /* Not particularly proud of this change, nor the matching one in ObsPluginSetup.cs, but it seems necessary to allow these
             * programs to be built regardless of the layout choosen for the files */
            FileVersionInfo ver = null;
            try
            {
                ver =
                    FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe"));
            }
            catch (FileNotFoundException ex)
            {
                project.SourceBaseDir = project.SourceBaseDir.Replace(@"Setup\bin\", "");
                ver =
                    FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, "CameraControl.exe"));
            }

            project.LicenceFile = @"Licenses\DigiCamControlLicence.rtf";

            project.Version = new Version(ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart, ver.FilePrivatePart);
            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            //project.MajorUpgradeStrategy.NewerProductInstalledErrorMessage = "A version of the digiCamControl already installed. Unistall it first from Control Panel !";
            project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize;
            ////project.MajorUpgradeStrategy.UpgradeVersions = VersionRange.ThisAndOlder;
            ////project.MajorUpgradeStrategy.PreventDowngradingVersions = VersionRange.ThisAndOlder;

            project.ControlPanelInfo.Manufacturer = "Duka Istvan";
            project.OutFileName = string.Format("digiCamControlsetup_{0}", ver.FileVersion);
            project.ControlPanelInfo.ProductIcon = "logo.ico";
            if (System.IO.Directory.Exists(Path.Combine(project.SourceBaseDir, "Branding")))
            {
                appDir.AddDir(new Dir(appFeature, "Branding",
                    new Files(appFeature, @"Branding\*.*")));
            }

            string branding = Path.Combine(project.SourceBaseDir, "branding.xml");
            if (System.IO.File.Exists(branding))
            {
                var doc = new XmlDocument();
                doc.LoadXml(System.IO.File.ReadAllText(branding));
                string name = doc.DocumentElement.SelectSingleNode("/Branding/ApplicationTitle").InnerText;
                project.ControlPanelInfo.Manufacturer = name;
                project.OutFileName = string.Format(name.Replace(" ", "_") + "_{0}", ver.FileVersion);
                appDir.AddFile(new File(appFeature, "branding.xml"));
                project.Name = name;
                if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "logo.ico")))
                {
                    project.ControlPanelInfo.ProductIcon = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico");
                    shortcut.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico");
                    shortcutD.IconFile = Path.Combine(project.SourceBaseDir, "Branding", "logo.ico");
                    shortcut.Name = name;
                    shortcutD.Name = name;
                }
                if (System.IO.File.Exists(Path.Combine(project.SourceBaseDir, "Branding", "Licence.rtf")))
                    project.LicenceFile = "Branding\\Licence.rtf";

            }
            project.InstallScope = InstallScope.perMachine;
            project.ResolveWildCards();
            Compiler.PreserveTempFiles = false;
            string productMsi = Compiler.BuildMsi(project);
            string obsMsi = ObsPluginSetup.Execute();
            Thread.Sleep(2000);
            var dict = new Dictionary<string, string>();
            dict.Add("Visible","yes");
            var bootstrapper =new Bundle(project.Name,
            new PackageGroupRef("NetFx46Web"),
            //new ExePackage("vcredist_x86.exe"){InstallCommand ="/quite" },
            new MsiPackage(Path.Combine(Path.GetDirectoryName(productMsi), "IPCamAdapter.msi")) { Permanent = false,Attributes = dict},
            new MsiPackage(obsMsi) { Id = "ObsPackageId", Attributes = dict },
            new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = true, Attributes = dict });

            bootstrapper.Copyright = project.ControlPanelInfo.Manufacturer;
            bootstrapper.Version = project.Version;
            bootstrapper.UpgradeCode = new Guid("19d12628-7654-4354-a305-3A2057E2E6C9");
            bootstrapper.DisableModify = "yes";
            bootstrapper.DisableRemove = true;
            //bootstrapper.Application = new LicenseBootstrapperApplication()
            //{
            //    LicensePath = Path.Combine(project.SourceBaseDir, project.LicenceFile),
            //    LogoFile = project.ControlPanelInfo.ProductIcon,

            //};
            bootstrapper.IconFile = project.ControlPanelInfo.ProductIcon;
            bootstrapper.PreserveTempFiles = true;
            bootstrapper.OutFileName = project.OutFileName;

            bootstrapper.Build();
        }
    /// <summary>
    /// Builds setup.exe for SonarQube installation
    /// </summary>
    static void CreateBundle(string archType, string sonarQubeMsi, string sqlExpressMsi, Guid upgradeCode)
    {
        string bundleName = string.Format("{0} (x{1})", BootstrapperConstants.FormalProductName, archType);
        string outFileName = string.Format(BootstrapperConstants.SonarQubeProductName + "-x{0}.exe", archType);
        var bootstrapper = new Bundle(bundleName,
                                      new PackageGroupRef("NetFx40Web"),
                                      new MsiPackage(sqlExpressMsi)
                                      {
                                          Id = "SqlExpressPackage",
                                          InstallCondition = "INSTALLSQL=\"TRUE\""
                                      },
                                      new MsiPackage(sonarQubeMsi)
                                      {
                                          Id = "SonarQubePackage",
                                          MsiProperties = "INSTALLDIR=[INSTALLDIR];SETUPTYPE=[SETUPTYPE];PORT=[PORT];INSTANCE=[INSTANCE];"
                                                          + "SQLAUTHTYPE=[SQLAUTHTYPE];INSTALLSERVICE=[INSTALLSERVICE];DATABASEUSERNAME=[DATABASEUSERNAME];"
                                                          + "DATABASEPASSWORD=[DATABASEPASSWORD];DATABASENAME=[DATABASENAME];"
                                                          + "CURRENTLOGGEDINUSER=[CURRENTLOGGEDINUSER];DBENGINE=[DBENGINE];DBPORT=[DBPORT]"
                                      });

        bootstrapper.Version = new Version(BootstrapperConstants.ProductVersion);
        bootstrapper.UpgradeCode = upgradeCode;
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%");
        bootstrapper.PreserveTempFiles = true;
        bootstrapper.StringVariablesDefinition = "INSTALLDIR=" + BootstrapperConstants.DefaultInstallDir
                                                 + ";INSTALLSQL=FALSE;SETUPTYPE=EVALUATION;PORT=9000;"
                                                 + "SQLAUTHTYPE=WINDOWS;INSTALLSERVICE=YES;INSTANCE=LOCALHOST;"
                                                 + "DATABASENAME=sonarqubedb;DATABASEUSERNAME=sonarqube;DATABASEPASSWORD=sonarqube;"
                                                 + "CURRENTLOGGEDINUSER=default;DBENGINE=H2;DBPORT=1433";
        bootstrapper.IconFile = @"Resources\setup.ico";
        bootstrapper.Build(outFileName);
    }