如何更改wixsharp引导程序InstallDir

时间:2018-07-30 14:03:38

标签: wix bootstrapper wixsharp

我的 HyperlinkLargeTheme.xml 中包含以下代码:

<Editbox Name="InstallDir" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes">[InstallDir]</Editbox>
<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">Browse</Button>

以下是在C#中如何使用引导程序的代码:

        var bootstrapper =
            new Bundle(ProductInformation.ProductName, netPckg, cppRedistributables, erlangPackage, rabbitMqPackage, sdkPackage, webPackage)
            {
                OutFileName = ProductInformation.ProductName,
                Manufacturer = ProductInformation.Manufacturer,
                Version = new Version(ProductInformation.Version),
                UpgradeCode = new Guid(ProductInformation.UpgradeCodeBundle),
                StringVariablesDefinition = @"InstallDir=[ProgramFilesFolder][WixBundleManufacturer];ServerIp=127.0.0.1;ServerPort=12543;DbConnStr=;WebSitePort=80"
            };

        bootstrapper.DisableModify = "yes";

        bootstrapper.IncludeWixExtension(WixExtension.Util);
        bootstrapper.Application.LogoFile = @"Images\WizardSmallImageFile.bmp";
        bootstrapper.Application.Attributes.Add("ThemeFile", @"Theme\HyperlinkLargeTheme.xml");
        bootstrapper.Application.LocalizationFile = @"Theme\HyperlinkTheme.wxl";

        bootstrapper.WixSourceGenerated += Bootstrapper_WixSourceGenerated;
        bootstrapper.IconFile = ProductInformation.IconFile;
        bootstrapper.OutFileName = ProductInformation.ProductName + " " + ProductInformation.Version;
        bootstrapper.OutDir = AppDomain.CurrentDomain.BaseDirectory;

        bootstrapper.PreserveTempFiles = true;
        var productMsi = bootstrapper.Build();

然后,安装程序将使用editbox的内容将文件放置在正确的位置。但是,当使用BrowseButton浏览文件夹时,editbox的内容不会更改。如果我将Editbox的name属性设置为“ FolderEditbox”,则浏览按钮将像扩展按钮一样工作,但是无论Editbox的内容如何,​​文件都将安装到默认的安装目录。如何通过按钮浏览和安装到所选目录来完成?

0 个答案:

没有答案