示例#1
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.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();
    }
示例#2
0
        private static void BuildBundle(Platform platform, string dataFolder, string msiFile)
        {
            var bootstrapper =
                new Bundle("Personal House",
                           new PackageGroupRef("NetFx40Web"),
                           new ExePackage(Path.Combine(dataFolder, "DokanSetup_redist.exe"))
            {
                Vital            = true,
                InstallCondition = new Condition("InstallDokanDriver=\"yes\""),
                InstallCommand   = "/install /passive /norestart"
            },
                           new MsiPackage(msiFile)
            {
                Id = BA.MainPackageId,
                DisplayInternalUI = true,
                Visible           = true,
                MsiProperties     = "ProductLanguage=[ProductLanguage]"
            });

            bootstrapper.SetVersionFromFile(msiFile);
            bootstrapper.UpgradeCode = new Guid("821F3AF0-1F3B-4211-8D5F-E0C076111058");
            bootstrapper.Application = new ManagedBootstrapperApplication("%this%", "BootstrapperCore.config");

            bootstrapper.SuppressWixMbaPrereqVars = true;
            bootstrapper.PreserveTempFiles        = true;

            bootstrapper.DisableModify = "yes";
            bootstrapper.DisableRemove = true;

            bootstrapper.Build(msiFile.PathChangeExtension(".exe"));
        }
示例#3
0
    /// <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);
    }
示例#4
0
    //The UI implementation is based on the work of BRYANPJOHNSTON
    //http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

    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.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);
    }
示例#5
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
        };
        //---------------------------------------------------------
        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);
        }
    }
示例#6
0
    //The UI implementation is based on the work of BRYANPJOHNSTON
    //http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

    static public void Main()
    {
        var productProj =
            new ManagedProject("My Product",
                               new Dir(@"%ProgramFiles%\My Company\My Product",
                                       new File("readme.txt")))
        {
            InstallScope = InstallScope.perMachine
        };

        productProj.Load += (SetupEventArgs e) =>
        {
            MessageBox.Show(e.Session.Property("USERINPUT"));
        };

        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",
            DisplayInternalUI = true,
            MsiProperties     = "USERINPUT=[UserInput]"
        });

        bootstrapper.Variables   = new[] { new Variable("UserInput", "<none>"), };
        bootstrapper.Version     = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");

        // You can also use System.Reflection.Assembly.GetExecutingAssembly().Location instead of "%this%"
        // Note, passing BootstrapperCore.config is optional and if not provided the default BootstrapperCore.config
        // will be used. The content of the default BootstrapperCore.config can be accessed via
        // ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent.
        //
        // Note that the DefaultBootstrapperCoreConfigContent may not be suitable for all build and runtime scenarios.
        // In such cases you may need to use custom BootstrapperCore.config as demonstrated below.
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%", "BootstrapperCore.config");

        bootstrapper.PreserveTempFiles        = true;
        bootstrapper.SuppressWixMbaPrereqVars = true;

        bootstrapper.Build("my_app.exe");
        io.File.Delete(productMsi);
    }
示例#7
0
        static void Main()
        {
            var project = new ManagedProject("MyProduct",
                                             new Dir(@"%ProgramFiles%\My Company\My Product",
                                                     new File("Program.cs")));

            project.Language = "zh-CN";

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

            // project.ManagedUI = ManagedUI.DefaultWpf; // all stock UI dialogs

            //custom set of UI WPF dialogs
            project.ManagedUI = new ManagedUI();

            project.ManagedUI.InstallDialogs.Add <WixSharpWpfDemo.WelcomeDialog>()
            .Add <WixSharpWpfDemo.LicenceDialog>()
            .Add <WixSharpWpfDemo.FeaturesDialog>()
            .Add <WixSharpWpfDemo.InstallDirDialog>()
            .Add <WixSharpWpfDemo.ProgressDialog>()
            .Add <WixSharpWpfDemo.ExitDialog>();

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

            //project.SourceBaseDir = "<input dir path>";
            //project.OutDir = "<output dir path>";

            string productMsi = project.BuildMsi();

            var bootstrapper = new Bundle("My Product",
                                          //new PackageGroupRef("NetFx40Web"),
                                          new MsiPackage(productMsi)
            {
                DisplayInternalUI = true,    // 显示默认 UI
            }
                                          );

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

            // 注:以下的名字不填有可能冲突,填要注意不重要冲突。
            bootstrapper.Build("MyProject.exe");
        }
示例#8
0
    //The UI implementation is based on the work of BRYANPJOHNSTON
    //http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

    static public void Main()
    {
        var product =
            new Project("My Product",
                        new Dir(@"%ProgramFiles%\My Company\My Product",
                                new File("readme.txt")));

        product.InstallScope = InstallScope.perMachine;
        product.Language     = "en-US,de-DE,ru-RU";
        product.GUID         = new Guid("6f330b47-2577-43ad-9095-1861bb258771");

        product.PreserveTempFiles = true;
        string productMsi = product.BuildMultilanguageMsi();
        // string productMsi = @"E:\PrivateData\Galos\Projects\WixSharp\Source\src\WixSharp.Samples\Wix# Samples\Bootstrapper\MultiLanguageSupport\bin\Debug\My Product.msi";

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

        var bootstrapper =
            new Bundle("My Product",
                       new PackageGroupRef("NetFx40Web"),
                       new MsiPackage(productMsi)
        {
            Id = "MyProductPackageId",
            DisplayInternalUI = true,
            MsiProperties     = "USERINPUT=[UserInput]"
        });

        bootstrapper.Variables   = new[] { new Variable("UserInput", "<none>"), };
        bootstrapper.Version     = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");

        // You can also use System.Reflection.Assembly.GetExecutingAssembly().Location instead of "%this%"
        // Note, passing BootstrapperCore.config is optional and if not provided the default BootstrapperCore.config
        // will be used. The content of the default BootstrapperCore.config can be accessed via
        // ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent.
        //
        // Note that the DefaultBootstrapperCoreConfigContent may not be suitable for all build and runtime scenarios.
        // In such cases you may need to use custom BootstrapperCore.config as demonstrated below.
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%", "BootstrapperCore.config");

        bootstrapper.PreserveTempFiles        = true;
        bootstrapper.SuppressWixMbaPrereqVars = true;

        bootstrapper.Build("my_app.exe");
    }
示例#9
0
    static void Main()
    {
        DON'T FORGET to execute "install-package wixsharp" in the package manager console

            string productMsi = BuildMsi();

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

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

        bootstrapper.Build("MyProduct.exe");
    }
示例#10
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.perMachine
        };

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

        var bootstrapper =
            new Bundle("My Product Suite",
                       new PackageGroupRef("NetFx40Web"),
                       new MsiPackage(productMsi)
        {
            Id = "MyProductPackageId",
            DisplayInternalUI = true,
            Visible           = true   // show MSI entry in ARP
        });

        bootstrapper.SuppressWixMbaPrereqVars = true; //needed because NetFx40Web also defines WixMbaPrereqVars
        bootstrapper.Version     = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889c");

        // the following two assignments will hide Bundle entry form the Programs and Features (also known as Add/Remove Programs)
        bootstrapper.DisableModify = "yes";
        bootstrapper.DisableRemove = true;

        // if primary package Id is not defined then the last package will be treated as the primary one
        // bootstrapper.Application = new SilentBootstrapperApplication();

        // use this custom BA to modify its behavior in order to meet your requirements
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%");

        // You can implement your own extension types and add them to the Bundle
        // bootstrapper.GenericItems.Add(new BalCondition { Condition = "some condition", Message = "Warning: ..." });

        bootstrapper.PreserveTempFiles = true;
        bootstrapper.Build("app_setup");
    }
示例#11
0
    static public void Build_V2()
    {
        var productProj =
            new Project("My Product",
                        new Dir(@"%ProgramFiles%\My Company\My Product",
                                new File("readme.txt"),
                                new File("logo.png")))
        {
            InstallScope = InstallScope.perMachine
        };

        productProj.GUID         = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
        productProj.Version      = new Version("2.0.0.0");
        productProj.MajorUpgrade = new MajorUpgrade
        {
            Schedule = UpgradeSchedule.afterInstallInitialize,
            DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit."
        };

        string productMsi = productProj.BuildMsi();

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

        bootstrapper.AboutUrl                = "https://wixsharp.codeplex.com/";
        bootstrapper.IconFile                = "app_icon.ico";
        bootstrapper.Version                 = new Version("2.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.IncludeWixExtension(WixExtension.Util);

        bootstrapper.Build("setup_v2.exe");
        //---------------------------------------------------------
        if (io.File.Exists(productMsi))
        {
            io.File.Delete(productMsi);
        }
    }
示例#12
0
    static public void Main1()
    {
        var product =
            new Project("My Product",
                        new Dir(@"%ProgramFiles%\My Company\My Product",
                                new File("readme.txt")));

        product.InstallScope = InstallScope.perMachine;

        product.Version  = new Version("1.0.0.0");
        product.GUID     = new Guid("6f330b47-2577-43ad-9095-1861bb258771");
        product.Language = BA.Languages; // "en-US,de-DE,ru-RU";

        product.PreserveTempFiles = true;
        product.OutFileName       = $"{product.Name}.ml.v{product.Version}";

        var msiFile = $"{product.OutFileName}.msi".PathGetFullPath();
        //var msiFile = product.BuildMultilanguageMsi();

        var bootstrapper =
            new Bundle("My Product",
                       new PackageGroupRef("NetFx40Web"),
                       new MsiPackage(msiFile)
        {
            Id = BA.MainPackageId,
            DisplayInternalUI = true,
            Visible           = true,
            MsiProperties     = "TRANSFORMS=[TRANSFORMS]"
        });

        bootstrapper.SetVersionFromFile(msiFile);
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b");
        bootstrapper.Application = new ManagedBootstrapperApplication("%this%", "BootstrapperCore.config");

        bootstrapper.SuppressWixMbaPrereqVars = true;
        bootstrapper.PreserveTempFiles        = true;

        bootstrapper.Build(msiFile.PathChangeExtension(".exe"));
    }
示例#13
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.perMachine
        };

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

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

        bootstrapper.SuppressWixMbaPrereqVars = true; //needed because NetFx40Web also defines WixMbaPrereqVars
        bootstrapper.Version     = new Version("1.0.0.0");
        bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889c");

        //if primary package Id is not defined then the last package will be treated as the primary one
        bootstrapper.Application = new SilentBootstrapperApplication();

        //use this custom BA to modify its behavior in order to meet your requirements
        //bootstrapper.Application = new ManagedBootstrapperApplication("%this%");

        bootstrapper.PreserveTempFiles = true;
        bootstrapper.Build("app_setup");
    }
示例#14
0
        private static void Main(string[] args)
        {
            string product = BuildServiceMsi();
            string gui     = BuildGuiMsi();

            string version = Environment.GetEnvironmentVariable("GitVersion_AssemblySemVer") ?? System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

#pragma warning disable IDE0017 // Simplify object initialization
            var bootstrapper = new Bundle(Constants.ServiceDisplayName,
                                          new PackageGroupRef("NetFx452Web"),
                                          new ExePackage
            {
                DetectCondition = "NOT WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED",
                Id             = "NetFx452WebExe",
                InstallCommand = "/q /norestart /ChainingPackage LMS.Setup.exe",
                Compressed     = true,
                SourceFile     = "../Resources/DotNetFramework/NDP452-KB2901954-Web.exe",
                PerMachine     = true,
                Permanent      = true,
                Vital          = true
            },
                                          new ExePackage
            {
                Compressed       = true,
                InstallCommand   = "/i /qb",
                InstallCondition = "VersionNT64",
                PerMachine       = true,
                Permanent        = true,
                SourceFile       = "../Resources/SQLCompact/SSCERuntime_x64-ENU.exe",
                Vital            = true
            },
                                          new ExePackage
            {
                Compressed       = true,
                InstallCommand   = "/i /qb",
                InstallCondition = "NOT VersionNT64",
                PerMachine       = true,
                Permanent        = true,
                SourceFile       = "../Resources/SQLCompact/SSCERuntime_x86-ENU.exe",
                Vital            = true
            },
                                          new MsiPackage(product)
            {
                Compressed        = true,
                DisplayInternalUI = true,
                Visible           = false
            },
                                          new MsiPackage(gui)
            {
                Compressed        = true,
                DisplayInternalUI = true,
                Visible           = false
            }
                                          );
#pragma warning restore IDE0017                           // Simplify object initialization

            bootstrapper.SuppressWixMbaPrereqVars = true; // NetFx452Web also defines WixMbaPrereqVars
            bootstrapper.Version       = new Version(version);
            bootstrapper.UpgradeCode   = new Guid("dc9c2849-4c97-4f41-9174-d825ab335f9c");
            bootstrapper.OutDir        = "bin\\%Configuration%";
            bootstrapper.OutFileName   = "LMS.Setup";
            bootstrapper.IconFile      = "app_icon.ico";
            bootstrapper.HelpTelephone = "0845 413 88 99";
            bootstrapper.Manufacturer  = "Central Technology Ltd";

            // the following two assignments will hide Bundle entry form the Programs and Features (also known as Add/Remove Programs)
            bootstrapper.DisableModify = "yes";
            //  bootstrapper.DisableRemove = true;

            bootstrapper.PreserveTempFiles = true;

            bootstrapper.Validate();
            bootstrapper.Build();
        }
示例#15
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(@"MyAction", Return.ignore, When.Before, Step.InstallExecute,
                                                            Condition.NOT_Installed, Sequence.InstallExecuteSequence),
                                          new ManagedAction(@"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

            FileVersionInfo 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();

            var bootstrapper = new Bundle(project.Name,
                                          new PackageGroupRef("NetFx46Web"),
                                          new MsiPackage(Path.Combine(Path.GetDirectoryName(productMsi), "IPCamAdapter.msi")),
                                          new MsiPackage(obsMsi)
            {
                Id = "ObsPackageId",
            },
                                          new MsiPackage(productMsi)
            {
                Id = "MyProductPackageId",
            });
            bootstrapper.Copyright   = project.ControlPanelInfo.Manufacturer;
            bootstrapper.Version     = project.Version;
            bootstrapper.UpgradeCode = project.UpgradeCode.Value;
            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();
        }
示例#16
0
        public static void Main()
        {
            System.Reflection.Assembly         assembly        = System.Reflection.Assembly.GetExecutingAssembly();
            System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
            _logSystemVersion = fileVersionInfo.FileVersion;

            var productMsiUninstall = BuildMsiUninstall();
            //var productMsiLogViewer = BuildMsiLogViewer();
            var productMsiLogPresenter = BuildMsiLogPresenter();
            var productMsiLogServer    = BuildMsiLogServer();
            var productMsiRegistryX86  = BuildMsiRegistryX86();
            var productMsiRegistryX64  = BuildMsiRegistryX64();

            var bootstrapper =
                new Bundle(Product,
                           new MsiPackage(productMsiUninstall)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false,
                Cache             = false,
                MsiProperties     = "UNINSTALLER_PATH=[UNINSTALLER_PATH]"
            },
                           //new MsiPackage(productMsiLogViewer)
                           //{
                           //    DisplayInternalUI = false,
                           //    Compressed = true,
                           //    Visible = false
                           //},
                           new MsiPackage(productMsiLogPresenter)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false
            },
                           new MsiPackage(productMsiLogServer)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false
            },
                           new MsiPackage(productMsiRegistryX86)
            {
                DisplayInternalUI = false, Compressed = true, InstallCondition = "NOT VersionNT64"
            },
                           new MsiPackage(productMsiRegistryX64)
            {
                DisplayInternalUI = false, Compressed = true, InstallCondition = "VersionNT64"
            }
                           )
            {
                UpgradeCode  = new Guid("97C9A7F8-AFBB-4634-AD96-91EBC5F07419"),
                Version      = new Version(_logSystemVersion),
                Manufacturer = Manufacturer,
                AboutUrl     = "https://github.com/K-Society/KSociety.Log",
                Variables    = new[]
                {
                    new Variable("UNINSTALLER_PATH",
                                 $@"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}\{"Package Cache"}\{"[WixBundleProviderKey]"}\{Manufacturer + "." + Product}.exe")
                }
            };

            bootstrapper.Build(Manufacturer + "." + Product + ".exe");

            if (System.IO.File.Exists(productMsiUninstall))
            {
                System.IO.File.Delete(productMsiUninstall);
            }

            if (System.IO.File.Exists(productMsiLogPresenter))
            {
                System.IO.File.Delete(productMsiLogPresenter);
            }

            if (System.IO.File.Exists(productMsiLogServer))
            {
                System.IO.File.Delete(productMsiLogServer);
            }

            if (System.IO.File.Exists(productMsiRegistryX86))
            {
                System.IO.File.Delete(productMsiRegistryX86);
            }
            if (System.IO.File.Exists(productMsiRegistryX64))
            {
                System.IO.File.Delete(productMsiRegistryX64);
            }
        }
示例#17
0
    static public void Main(string[] args)
    {
        string productMsi = BuildMainMsi();

        string crtMsi = BuildCrtMsi();
        //---------------------------------------------------------

        var msiOnlinePackage = new MsiPackage(crtMsi) //demo for downloadable msi package
        {
            Vital             = true,
            Compressed        = false,
            DisplayInternalUI = true,
            DownloadUrl       = @"https://dl.dropboxusercontent.com/....../CRT.msi"
        };

        var bootstrapper =
            new Bundle("My Product",
                       new PackageGroupRef("NetFx40Web"),
                       //new ExePackage(@"..\redist\dotNetFx40_Full_x86_x64.exe") //just a demo sample
                       //{
                       //     Name = "Microsoft .NET Framework 4.0",
                       //     InstallCommand = "/passive /norestart",
                       //     Permanent = true,
                       //     Vital = true,
                       //     DetectCondition = "Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)",
                       //     Compressed = true
                       //},

                       //msiOnlinePackage, //just a demo sample

                       new MsiPackage(crtMsi)
        {
            DisplayInternalUI = true, MsiProperties = "PACKAGE_PROPERTY=[BundleVariable]"
        },
                       new MsiPackage(productMsi)
        {
            DisplayInternalUI = true
        });

        bootstrapper.AboutUrl                = "https://wixsharp.codeplex.com/";
        bootstrapper.IconFile                = "app_icon.ico";
        bootstrapper.Version                 = Tasks.GetVersionFromFile(productMsi); //will extract "product version"
        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.IncludeWixExtension(WixExtension.Util);

        // The code below sets WiX variables 'Netfx4FullVersion' and 'AdobeInstalled'. Note it has no affect on
        //the runtime behavior and use of 'FileSearch' and "RegistrySearch" only provided as an example.
        bootstrapper.AddWixFragment("Wix/Bundle",
                                    new UtilRegistrySearch
        {
            Root     = RegistryHive.LocalMachine,
            Key      = @"Key=SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full",
            Value    = "Version",
            Variable = "Netfx4FullVersion"
        },
                                    new UtilFileSearch
        {
            Path     = @"[ProgramFilesFolder]Adobe\adobe.exe",
            Result   = SearchResult.exists,
            Variable = "AdobeInstalled"
        });
        bootstrapper.StringVariablesDefinition += "BundleVariable=333";
        bootstrapper.PreserveTempFiles          = true;

        // Add MspPackage manually (demo only).
        // In the future releases the direct support for MspPackage element will be added.
        // bootstrapper.WixSourceGenerated += (doc) => doc.FindSingle("Chain")
        //                                                .AddElement("MspPackage",
        //                                                            "SourceFile=Patch.msp; Slipstream=no");

        //in real life scenarios suppression may need to be enabled (see SuppressWixMbaPrereqVars documentation)
        //bootstrapper.SuppressWixMbaPrereqVars = true;

        var setup = bootstrapper.Build("app_setup");

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

        if (io.File.Exists(productMsi))
        {
            io.File.Delete(productMsi);
        }
        if (io.File.Exists(crtMsi))
        {
            io.File.Delete(crtMsi);
        }
    }
示例#18
0
    static public void Main()
    {
        string productMsi = BuildMainMsi();
        string crtMsi     = BuildCrtMsi();

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

        var msiOnlinePackage = new MsiPackage(crtMsi) //demo for downloadable msi package
        {
            Vital             = true,
            Compressed        = false,
            DisplayInternalUI = true,
            DownloadUrl       = @"https://dl.dropboxusercontent.com/....../CRT.msi"
        };

        // Compiler.AutoGeneration.SuppressForBundleUndefinedIds = false;
        // Compiler.AutoGeneration.LegacyDefaultIdAlgorithm = false;

        var bootstrapper =
            new Bundle("My Product",
                       new PackageGroupRef("NetFx40Web"),
                       //new ExePackage(@"..\redist\dotNetFx40_Full_x86_x64.exe") //just a demo sample
                       //{
                       //     Name = "Microsoft .NET Framework 4.0",
                       //     InstallCommand = "/passive /norestart",
                       //     Permanent = true,
                       //     Vital = true,
                       //     DetectCondition = "Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)",
                       //     Compressed = true
                       //},

                       //msiOnlinePackage, //just a demo sample

                       new MsiPackage(crtMsi)
        {
            DisplayInternalUI = true,
            Visible           = true,
            MsiProperties     = "PACKAGE_PROPERTY=[BundleVariable]"
        },
                       new MsiPackage(productMsi)
        {
            DisplayInternalUI = true,
            Payloads          = new[] { "script.dll".ToPayload() }
        });

        bootstrapper.AboutUrl             = "https://github.com/oleg-shilo/wixsharp/";
        bootstrapper.IconFile             = "app_icon.ico";
        bootstrapper.Version              = Tasks.GetVersionFromFile(productMsi); //will extract "product version"
        bootstrapper.UpgradeCode          = new Guid("6f330b47-2577-43ad-9095-1861bb25889b");
        bootstrapper.Application.LogoFile = "logo.png";
        bootstrapper.Application.Payloads = new[] { "logo.png".ToPayload() };

        // adding themes
        // var themes = new[]
        //     {
        //         new Payload("managedsetup.wxl") { Name = "1033\thm.wxl" }
        //     };
        // bootstrapper.Application.Payloads = themes;

        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.Application.AttributesDefinition = "ShowVersion=yes; ShowFilesInUse=yes";
        bootstrapper.Include(WixExtension.Util);

        bootstrapper.IncludeWixExtension(@"WixDependencyExtension.dll", "dep", "http://schemas.microsoft.com/wix/DependencyExtension");
        bootstrapper.AttributesDefinition = "{dep}ProviderKey=01234567-8901-2345-6789-012345678901";

        // The code below sets WiX variables 'Netfx4FullVersion' and 'AdobeInstalled'. Note it has no affect on
        //the runtime behaviour and 'FileSearch' and "RegistrySearch" are only provided as an example.
        bootstrapper.AddWixFragment("Wix/Bundle",
                                    new UtilRegistrySearch
        {
            Root     = RegistryHive.LocalMachine,
            Key      = @"SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full",
            Value    = "Version",
            Variable = "Netfx4FullVersion"
        },
                                    new UtilFileSearch
        {
            Path     = @"[ProgramFilesFolder]Adobe\adobe.exe",
            Result   = SearchResult.exists,
            Variable = "AdobeInstalled"
        });

        // bootstrapper.AddXml("Wix/Bundle", "<Log PathVariable=\"LogFileLocation\"/>");

        bootstrapper.AddXmlElement("Wix/Bundle", "Log", "PathVariable=LogFileLocation");
        bootstrapper.Variables = new[] { new Variable("LogFileLocation", @"C:\temp\setup.log")
                                         {
                                             Overridable = true
                                         } };
        // or
        // bootstrapper.Variables = "BundleVariable=333".ToStringVariables();
        // bootstrapper.Variables = Variables.ToStringVariables("BundleVariable=333");

        bootstrapper.PreserveTempFiles = true;

        // Add MspPackage manually (demo only).
        // In the future releases the direct support for MspPackage element will be added.
        // bootstrapper.WixSourceGenerated += (doc) => doc.FindSingle("Chain")
        //                                                .AddElement("MspPackage",
        //                                                            "SourceFile=Patch.msp; Slipstream=no");

        // bootstrapper.WixSourceGenerated += doc => doc.FindSingle("WixStandardBootstrapperApplication")
        //                                              .AddAttributes("ShowVersion=yes; ShowFilesInUse=no");

        //in real life scenarios suppression may need to be enabled (see SuppressWixMbaPrereqVars documentation)
        //bootstrapper.SuppressWixMbaPrereqVars = true;
        var setup = bootstrapper.Build("app_setup");

        Console.WriteLine(setup);
        //---------------------------------------------------------

        if (io.File.Exists(productMsi))
        {
            io.File.Delete(productMsi);
        }
        if (io.File.Exists(crtMsi))
        {
            io.File.Delete(crtMsi);
        }
    }
示例#19
0
        static void Main(string[] args)
        {
            try
            {
                WixSharp.File ui = new WixSharp.File(
                    @"cli\WindowsServiceTestClient.exe",
                    new WixSharp.FileShortcut("WindowsServiceTestClient", @"%ProgramMenu%\cocoalix")
                {
                    Advertise = true
                }
                    );
                WixSharp.File service = new WixSharp.File(
                    @"service\WindowsServiceTest.exe"
                    );
                WixSharp.Files uiDepends = new WixSharp.Files(
                    @"cli\*.*"
                    );
                WixSharp.Files serviceDepends = new WixSharp.Files(
                    @"service\*.*"
                    );

                var dir = new WixSharp.Dir(new WixSharp.Id("InstallDir"),
                                           @"%ProgramFiles%\cocoalix",
                                           // インストーラーにインクルードするファイル
                                           ui,
                                           // インストーラーにインクルードするファイル
                                           service,
                                           uiDepends,
                                           serviceDepends
                                           );

                var project = new WixSharp.ManagedProject("ウィンドウズサービステスト", dir);

                project.Platform = Platform.x64;

                // 日本語をインストーラ及びWiXで仕様するためのおまじない
                project.Codepage = "932";
                project.Language = "ja-JP";

                // アップグレードコードを指定 (変更厳禁)
                project.GUID = new Guid("abbb7cf9-19fa-45f2-babc-a35312741772");

                // インストーラーのファイル名
                project.OutFileName = "ウィンドウズサービステストインストーラ";

                service.ServiceInstaller = new WixSharp.ServiceInstaller
                {
                    Account      = @"NT Authority\System",
                    PermissionEx = new WixSharp.PermissionEx()
                    {
                        User = @"Administrator",
                        ServicePauseContinue = false,
                        ServiceStart         = true,
                        ServiceStop          = true,
                    },
                    Name                    = "WindowsServiceTestService",
                    Description             = "ウィンドウズサービステストのサービスです",
                    StartOn                 = WixSharp.SvcEvent.Install,
                    StopOn                  = WixSharp.SvcEvent.InstallUninstall_Wait,
                    RemoveOn                = WixSharp.SvcEvent.Uninstall_Wait,
                    DelayedAutoStart        = true,
                    FirstFailureActionType  = WixSharp.FailureActionType.restart,
                    SecondFailureActionType = WixSharp.FailureActionType.restart,
                    ThirdFailureActionType  = WixSharp.FailureActionType.none,
                    PreShutdownDelay        = 1000 * 60 * 3,
                    ServiceSid              = WixSharp.ServiceSid.none,
                };

                // インストーラで表示するウィンドウ群の指定
                project.ManagedUI = new WixSharp.ManagedUI();
                project.ManagedUI.InstallDialogs.Add(WixSharp.Forms.Dialogs.Welcome)
                .Add(WixSharp.Forms.Dialogs.Licence)
                .Add(WixSharp.Forms.Dialogs.Progress)
                .Add(WixSharp.Forms.Dialogs.Exit);

                project.LicenceFile = @"Eula.rtf";

                // インストール時権限昇格
                project.InstallPrivileges = InstallPrivileges.elevated;
                project.InstallScope      = InstallScope.perMachine;

                project.PreserveTempFiles = true;

                var projectMsi = project.BuildMsi();

                var bootstrapper = new Bundle(
                    "ウィンドウズサービステスト_バンドルインストーラ",
                    new ExePackage()
                {
                    Id               = "DotNet5DesktopRuntime",
                    Name             = "dotnet5-windowsdesktop-runtime-5.0-win-x64.exe",
                    Vital            = true,
                    Permanent        = false,
                    DownloadUrl      = @"https://download.visualstudio.microsoft.com/download/pr/7a5d15ae-0487-428d-8262-2824279ccc00/6a10ce9e632bce818ce6698d9e9faf39/windowsdesktop-runtime-5.0.4-win-x64.exe",
                    InstallCommand   = "/install /quiet",
                    RepairCommand    = "/repair /quiet",
                    UninstallCommand = "/uninstall /quiet",
                    LogPathVariable  = "dotnet5desktopruntime.log",
                    Compressed       = true,

                    // RemotePayloadは以下のコマンドで取得可能
                    // heat payload <バンドルしたいexeのバイナリのパス> -out .\remote.xml
                    RemotePayloads = new[]
                    {
                        new RemotePayload()
                        {
                            ProductName           = "Microsoft Windows Desktop Runtime - 5.0.4 (x64)",
                            Description           = "Microsoft Windows Desktop Runtime - 5.0.4 (x64)",
                            Hash                  = "33FBCDB6B6F052FCC26B4EF850B81ED5F2C10B02",
                            Size                  = 54790696,
                            Version               = "5.0.4.29817".ToRawVersion(),
                            CertificatePublicKey  = "3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18",
                            CertificateThumbprint = "2485A7AFA98E178CB8F30C9838346B514AEA4769"
                        }
                    }
                },
                    new MsiPackage(projectMsi)
                    );

                // ランタイムバンドルインストーラのバージョン
                bootstrapper.Version = new Version("1.0.0.0");

                // ランタイムバンドルインストーラのアップグレードコード (変更厳禁)
                bootstrapper.UpgradeCode = new Guid("bf3b1aeb-12c5-4401-ad23-6a49f905bd55");

                // ランタイムバンドルインストーラのアプリケーションスタイルの定義
                bootstrapper.Application             = new LicenseBootstrapperApplication();
                bootstrapper.Application.LicensePath = @".\Eula.rtf";

                bootstrapper.Application.LocalizationFile = "thm.wxl";

                // インストール時のOption非表示
                bootstrapper.Application.SuppressOptionsUI = true;
                // アンインストール時の修復を非表示
                bootstrapper.Application.SuppressRepair = true;

                // 一次領域を使用するか
                bootstrapper.PreserveTempFiles = true;
                // Wixの必須パラメータの定義?は行わない
                bootstrapper.SuppressWixMbaPrereqVars = false;

                // インストーラ名の定義
                bootstrapper.OutFileName = "ウィンドウズサービステスト_バンドルインストーラ";

                // ランタイムバンドルインストーラの作成
                bootstrapper.Build();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
示例#20
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);
        }
示例#21
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);
        }
示例#22
0
        public static void Main()
        {
            System.Reflection.Assembly         assembly        = System.Reflection.Assembly.GetExecutingAssembly();
            System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
            _comSystemVersion = fileVersionInfo.FileVersion;

            var productMsiUninstall    = BuildMsiUninstall();
            var productMsiComPresenter = BuildMsiComPresenter();
            var productMsiComServer    = BuildMsiComServer();
            var productMsiRegistryX86  = BuildMsiRegistryX86();
            var productMsiRegistryX64  = BuildMsiRegistryX64();

            var bootstrapper =
                new Bundle(Manufacturer + "." + Product,
                           new MsiPackage(productMsiUninstall)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false,
                Cache             = false,
                MsiProperties     = "UNINSTALLER_PATH=[UNINSTALLER_PATH]"
            },
                           new MsiPackage(productMsiComPresenter)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false
            },
                           new MsiPackage(productMsiComServer)
            {
                DisplayInternalUI = false,
                Compressed        = true,
                Visible           = false
            },
                           new MsiPackage(productMsiRegistryX86)
            {
                DisplayInternalUI = false, Compressed = true, InstallCondition = "NOT VersionNT64"
            },
                           new MsiPackage(productMsiRegistryX64)
            {
                DisplayInternalUI = false, Compressed = true, InstallCondition = "VersionNT64"
            }
                           )
            {
                UpgradeCode  = new Guid("BBD5FA92-3E78-4CD8-AD3A-8EC4AEC889F7"),
                Version      = new Version(_comSystemVersion),
                Manufacturer = Manufacturer,
                AboutUrl     = "https://github.com/K-Society/KSociety.Com",
                Id           = "Com_System",
                //IconFile = @"..\..\..\assets\icon\icon.ico",
                Variables = new []
                {
                    new Variable("UNINSTALLER_PATH",
                                 $@"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}\{"Package Cache"}\{"[WixBundleProviderKey]"}\{Manufacturer + "." + Product}.exe")
                }
            };

            bootstrapper.Build(Manufacturer + "." + Product + ".exe");

            if (System.IO.File.Exists(productMsiUninstall))
            {
                System.IO.File.Delete(productMsiUninstall);
            }

            if (System.IO.File.Exists(productMsiComPresenter))
            {
                System.IO.File.Delete(productMsiComPresenter);
            }

            if (System.IO.File.Exists(productMsiComServer))
            {
                System.IO.File.Delete(productMsiComServer);
            }

            if (System.IO.File.Exists(productMsiRegistryX86))
            {
                System.IO.File.Delete(productMsiRegistryX86);
            }
            if (System.IO.File.Exists(productMsiRegistryX64))
            {
                System.IO.File.Delete(productMsiRegistryX64);
            }
        }
示例#23
0
        static void Main(string[] args)
        {
            var productProj =
                new ManagedProject("My Product",
                                   new Dir("[INSTALLDIR]",
                                           new Dir("bin", new File("ui.config")),
                                           new Dir("obj", new File("ui.config"))
                                           ),
                                   new RegValue(RegistryHive.LocalMachine, @"SOFTWARE\My Product", "test", "testvalue"),
                                   new RemoveRegistryKey(RegistryHive.LocalMachine, @"Software\My Product"))
            {
                InstallPrivileges = InstallPrivileges.elevated,
                InstallScope      = InstallScope.perMachine,
                GUID = new Guid("6a330b47-2577-43ad-9095-1861bb25889a")
            };


            //productProj.Load += (SetupEventArgs e) => {
            //    e.Session.Property("INSTALLDIR");
            //};

            string productMsi = productProj.BuildMsi();

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

            var bootstrapper =
                new Bundle("TestInstall",
                           new PackageGroupRef("NetFx47Redist"),
                           new MsiPackage(productMsi)
            {
                Id = "TestInstall",
                DisplayInternalUI = false,
                MsiProperties     = @"USERINPUT=[UserInput];INSTALLDIR=[InstallPath]"
            });

            bootstrapper.WxsFiles.Add("Net47.wxs");
            bootstrapper.Include(WixExtension.Util);
            //bootstrapper.Include(WixExtension.NetFx);
            bootstrapper.AddXmlElement("Wix/Bundle", "Log", "PathVariable=LogFileLocation");
            bootstrapper.Variables = new[] {
                new Variable("LogFileLocation", $"D:\\log.txt")
                {
                    Overridable = true
                },
                new Variable("UserInput", "<none>"),
                new Variable("InstallPath", "[ProgramFiles6432Folder]\\My Company\\My Product"),
            };

            bootstrapper.AddWixFragment("Wix/Bundle",
                                        new UtilRegistrySearch {
                Root     = RegistryHive.LocalMachine,
                Key      = @"SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full",
                Value    = "Version",
                Variable = "Netfx4FullVersion",
                Result   = SearchResult.value
            });
            bootstrapper.Version     = new Version("1.0.0.0");
            bootstrapper.UpgradeCode = new Guid("6a330b47-2577-43ad-9095-1861bb25889a");
            bootstrapper.IconFile    = @"Res\test.ico";
            // You can also use System.Reflection.Assembly.GetExecutingAssembly().Location instead of "%this%"
            // Note, passing BootstrapperCore.config is optional and if not provided the default BootstrapperCore.config
            // will be used. The content of the default BootstrapperCore.config can be accessed via
            // ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent.
            //
            // Note that the DefaultBootstrapperCoreConfigContent may not be suitable for all build and runtime scenarios.
            // In such cases you may need to use custom BootstrapperCore.config as demonstrated below.
            bootstrapper.Application = new ManagedBootstrapperApplication(typeof(App).Assembly.Location);
            ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent = @"<?xml version=""1.0"" encoding=""utf-8"" ?><configuration><configSections><sectionGroup name=""wix.bootstrapper"" type=""Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore""><section name=""host"" type=""Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore"" /></sectionGroup></configSections><startup useLegacyV2RuntimeActivationPolicy=""true""><supportedRuntime version=""v4.0"" /></startup><wix.bootstrapper><host assemblyName=""WixBootstrapperWPF"">      <supportedFramework version=""v4\Full"" /><supportedFramework version=""v4\Client"" /></host></wix.bootstrapper></configuration>";
            //var asse = ass.GetExecutingAssembly();
            //var names = asse.GetManifestResourceNames();
            //using (io.StreamReader reader = new io.StreamReader(asse.GetManifestResourceStream("ui.config"))) {
            //    ManagedBootstrapperApplication.DefaultBootstrapperCoreConfigContent = reader.ReadToEnd();
            //}

            bootstrapper.PreserveTempFiles        = true;
            bootstrapper.SuppressWixMbaPrereqVars = true;

            bootstrapper.Build("my_app.exe");
        }
示例#24
0
        public void Build()
        {
            Compiler.WixLocation = Path.Combine(Environment.ExpandEnvironmentVariables(@"%USERPROFILE%"), ".nuget", "packages", "wixsharp.wix.bin", "3.11.0", "tools", "bin");
            var productId           = Guid.NewGuid();
            var projectBuilder      = new ProjectBuilder("4.6.1", productId);
            var projectBuilderNet40 = new ProjectBuilder("4.0", productId);

            Console.WriteLine($"Building {nameof(MsiPackage)}s...");
            var productMsi        = projectBuilder.BuildMsi();
            var productMsiNet40   = projectBuilderNet40.BuildMsi();
            var productMsiPackage = new MsiPackage(productMsi)
            {
                DisplayInternalUI = true, InstallCondition = "VersionNT >= v6.0", Visible = false
            };
            var productMsiPackageNet40 = new MsiPackage(productMsiNet40)
            {
                Id = "Computator.NET_Windows_XP", DisplayInternalUI = true, InstallCondition = "VersionNT < v6.0", Visible = false
            };



            Console.WriteLine($"Creating final {nameof(Bundle)} object");
            var bootstrapper =
                new Bundle("Computator.NET",
                           productMsiPackageNet40,
                           productMsiPackage)
            {
                IconFile      = SharedProperties.IconLocation,
                DisableModify = "yes",
                Version       = SharedProperties.Version,
                UpgradeCode   = new Guid(SharedProperties.UpgradeCode),
                HelpUrl       = SharedProperties.HelpUrl,
                AboutUrl      = SharedProperties.AboutUrl,
                UpdateUrl     = SharedProperties.UpdateUrl,
                HelpTelephone = SharedProperties.HelpTelephone,
                Manufacturer  = SharedProperties.Company,

                /*Application = new SilentBootstrapperApplication()
                 * {
                 *  LogoFile = SharedProperties.Logo,
                 *  LicensePath = SharedProperties.License,
                 * }*/
                Application = new LicenseBootstrapperApplication()
                {
                    LogoFile    = @"../Graphics/Installer/BootstrapperLogoFile65.png",      //SharedProperties.LogoBmp,
                    LicensePath = SharedProperties.License,                                 //@"https://github.com/PawelTroka/Computator.NET/blob/master/LICENSE"
                },
                SplashScreenSource = @"../Graphics/Installer/BootstrapperSplashScreen.bmp", //@"..\Graphics\computator.net-icon.png",//@"..\Graphics\Installer\InstallShield Computator.NET Theme\setup.gif",
                //PreserveTempFiles = true,
            };

            Console.WriteLine($"Adding .NET dependencies...");
            bootstrapper.Chain.InsertRange(0, new[]
            {
                new NetFx40WebInstaller().Build(bootstrapper),
                new NetFx461WebInstaller().Build(bootstrapper)
            });

            Console.WriteLine($"Adding {nameof(PatchKnowledgeBase2468871)} for async-await support on Windows XP.");
            var patchKnowledgeBase2468871 = new PatchKnowledgeBase2468871();
            var patchesForNet40           = patchKnowledgeBase2468871.Build(bootstrapper);

            bootstrapper.Chain.InsertRange(1, patchesForNet40);

            var finalPath = Path.Combine(SharedProperties.OutDir, "Computator.NET.Installer.exe");

            Console.WriteLine($"Building final bundle '{finalPath}'");
            bootstrapper.Build(finalPath);
        }