Пример #1
0
        public static string Execute()
        {
            Feature obsPlugin = new Feature("Obs Plugin");
            var obsDir = new Dir(@"%ProgramFiles%\OBS\plugins",
                new File(obsPlugin, @"ObsPlugin\CLRHostPlugin.dll"),
                new Dir(obsPlugin, "CLRHostPlugin",
                    new DirFiles(obsPlugin, @"ObsPlugin\CLRHostPlugin\*.*")
                    ));

            Project project = new Project("OBS plugin for digiCamControl",obsDir);

            project.SetNetFxPrerequisite("NETFRAMEWORK45 >= '#378389'", "Please install .Net 4.5 First");
            project.UI = WUI.WixUI_Minimal;
            project.GUID = new Guid("357E0D80-5093-478E-8C11-28B1A72096E7");

            #if DEBUG
            project.SourceBaseDir =
                Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Debug\"));
            #else
            project.SourceBaseDir =
                Path.GetFullPath(System.IO.Path.Combine(Environment.CurrentDirectory, @"..\CameraControl\bin\Release\"));
            #endif

            FileVersionInfo ver = null;
            try
            {
                ver =
                    FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, @"ObsPlugin\CLRHostPlugin", "DccObsPlugin.dll"));
            }
            catch (FileNotFoundException ex)
            {
                project.SourceBaseDir = project.SourceBaseDir.Replace(@"Setup\bin\", "");
                ver =
                    FileVersionInfo.GetVersionInfo(Path.Combine(project.SourceBaseDir, @"ObsPlugin\CLRHostPlugin", "DccObsPlugin.dll"));
            }

            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("ObsPluginSetup_{0}", ver.FileVersion);
            project.ControlPanelInfo.ProductIcon = "logo.ico";
            project.InstallScope = InstallScope.perMachine;

            project.ResolveWildCards();
            Compiler.PreserveTempFiles = false;
            return Compiler.BuildMsi(project);
        }
Пример #2
0
        static void Main()
        {
            var project = new Project("PhotoSorter",
                             new Dir(new Id("INSTALLDIR"), @"%LocalAppData%\PhotoSorter",
                                 new File(@"..\PhotoSorter\bin\Release\PhotoSorter.exe",
                                    new FileShortcut("PhotoSorter", @"%Desktop%"),
                                    new FileShortcut("PhotoSorter", @"%ProgramMenu%\PhotoSorter")),
                                 new Files(@"..\PhotoSorter\bin\Release\*.*", f => !f.EndsWith(".pdb") && !f.Contains("vshost") && !f.EndsWith("PhotoSorter.exe")),
                                 new ExeFileShortcut("Uninstall PhotoSorter", "[System64Folder]msiexec.exe", "/x [ProductCode]")
                                 {
                                     WorkingDirectory = "%Temp%"
                                 })
                             );
            project.GUID = new Guid("{5E1EED8B-5CEB-4EE7-BD2D-B7A4BFA836C0}");
            project.Codepage = "1251";
            project.Language = "ru-RU";
            project.SetVersionFromFile(@"..\PhotoSorter\bin\Release\PhotoSorter.exe");
            project.Media.CompressionLevel = CompressionLevel.high;
            project.Media.EmbedCab = true;
            project.UI = WUI.WixUI_Common;
            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.InstallScope = InstallScope.perUser;

            var customUi = new CustomUI();

            customUi.On(NativeDialogs.ExitDialog, Buttons.Finish, new CloseDialog() { Order = 9999 });

            customUi.On(NativeDialogs.WelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.InstallDirDlg));

            customUi.On(NativeDialogs.InstallDirDlg, Buttons.Back, new ShowDialog(NativeDialogs.WelcomeDlg));
            customUi.On(NativeDialogs.InstallDirDlg, Buttons.Next, new SetTargetPath(),
                                                             new ShowDialog(NativeDialogs.VerifyReadyDlg));

            customUi.On(NativeDialogs.InstallDirDlg, Buttons.ChangeFolder,
                                                             new SetProperty("_BrowseProperty", "[WIXUI_INSTALLDIR]"),
                                                             new ShowDialog(CommonDialogs.BrowseDlg));

            customUi.On(NativeDialogs.VerifyReadyDlg, Buttons.Back, new ShowDialog(NativeDialogs.InstallDirDlg, Condition.NOT_Installed),
                                                                    new ShowDialog(NativeDialogs.MaintenanceTypeDlg, Condition.Installed));

            customUi.On(NativeDialogs.MaintenanceWelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.MaintenanceTypeDlg));

            customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Back, new ShowDialog(NativeDialogs.MaintenanceWelcomeDlg));
            customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Repair, new ShowDialog(NativeDialogs.VerifyReadyDlg));
            customUi.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Remove, new ShowDialog(NativeDialogs.VerifyReadyDlg));
            project.SetNetFxPrerequisite(Condition.Net45_Installed, "Please install .Net FrameWork 4.5");
            project.CustomUI = customUi;
            project.OutFileName = "PhotoSorterSetup";
            project.PreserveTempFiles = true;
            project.ResolveWildCards(true);
            project.BuildMsi();
        }
Пример #3
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)
                );

            project.UI = WUI.WixUI_InstallDir;
            project.GUID = new Guid("19d12628-7654-4354-a305-9ab0932af676");
            project.SetNetFxPrerequisite("NETFRAMEWORK40FULL='#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.ControlPanelInfo.ProductIcon = "Branding\\Licence.rtf";

            }

            project.ResolveWildCards();
            Compiler.PreserveTempFiles = true;
            Compiler.BuildMsi(project);
            ObsPluginSetup.Execute();
        }