예제 #1
0
        static void Main()
        {
            var info        = XDocument.Load(@"wix\SetupInfo.wxi");
            var productName = info.Text("PRODUCT_NAME");
            var companyName = info.Text("COMPANY_NAME");
            var xllDirPath  = info.Text("XLL_DIR_PATH");
            var xll32       = info.Text("XLL32");
            var xll64       = info.Text("XLL64");
            var caOpenPath  = info.Text("CA_OPEN_PATH");

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

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

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

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

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