Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix 如何在burn引导程序应用程序中显示磁盘空间不足消息?_Wix_Windows Installer_Bootstrapper_Burn_Wix3.10 - Fatal编程技术网

Wix 如何在burn引导程序应用程序中显示磁盘空间不足消息?

Wix 如何在burn引导程序应用程序中显示磁盘空间不足消息?,wix,windows-installer,bootstrapper,burn,wix3.10,Wix,Windows Installer,Bootstrapper,Burn,Wix3.10,我用burn bootstrapper编写了自己的安装程序UI。它有一个WPF前端。我有一个包含3个MSI包的EXE。因此,当我试图将其安装在空间不足的磁盘上时,如何在安装程序UI中显示错误消息对话框?是否有一个回调,我可以使用它查找是否有足够的磁盘空间?请给出建议。我也在考虑这样做 秘密在于读取和解析BootstrapperApplicationData.xml。 然后可以从WixPackageProperties元素中使用InstalledSize属性。此链接显示如何在运行时读取该文件。请注

我用burn bootstrapper编写了自己的安装程序UI。它有一个WPF前端。我有一个包含3个MSI包的EXE。因此,当我试图将其安装在空间不足的磁盘上时,如何在安装程序UI中显示错误消息对话框?是否有一个回调,我可以使用它查找是否有足够的磁盘空间?请给出建议。

我也在考虑这样做

秘密在于读取和解析BootstrapperApplicationData.xml。 然后可以从WixPackageProperties元素中使用InstalledSize属性。此链接显示如何在运行时读取该文件。请注意,您必须将InstalledSize添加到相关结构中

这将取决于您去检查磁盘空间与这些数字的总和,并在安装前标记给用户

这是我的一些代码的复制/粘贴:

using System.Collections.ObjectModel;
using System.Xml.Serialization;

public class PackageInfo
{
    [XmlAttribute("Package")]
    public string Id { get; set; }

    [XmlAttribute("DisplayName")]
    public string DisplayName { get; set; }

    [XmlAttribute("Description")]
    public string Description { get; set; }

    [XmlAttribute("InstalledSize")]
    public int InstalledSize { get; set; }

}

[XmlRoot("BootstrapperApplicationData", IsNullable = false, Namespace = "http://schemas.microsoft.com/wix/2010/BootstrapperApplicationData")]
public class BundleInfo
{
    [XmlElement("WixPackageProperties")]
    public Collection<PackageInfo> Packages { get; set; } = new Collection<PackageInfo>();
}

public static class BundleInfoLoader
{
    private static readonly string bootstrapperApplicationData = "BootstrapperApplicationData.xml";

    public static BundleInfo Load()
    {
        var bundleFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

        var path = Path.Combine(bundleFolder, bootstrapperApplicationData);

        var xmlSerializer = new XmlSerializer(typeof(BundleInfo));
        BundleInfo result;
        using (var fileStream = new FileStream(path, FileMode.Open))
        {
            var xmlReader = XmlReader.Create(fileStream);
            result = (BundleInfo)xmlSerializer.Deserialize(xmlReader);
        }

        return result;
    }
}
使用System.Collections.ObjectModel;
使用System.Xml.Serialization;
公共类PackageInfo
{
[XmlAttribute(“包”)]
公共字符串Id{get;set;}
[XmlAttribute(“显示名称”)]
公共字符串DisplayName{get;set;}
[XmlAttribute(“说明”)]
公共字符串说明{get;set;}
[XmlAttribute(“InstalledSize”)]
public int InstalledSize{get;set;}
}
[XmlRoot(“BootstrapperApplicationData”,IsNullable=false,Namespace=”http://schemas.microsoft.com/wix/2010/BootstrapperApplicationData")]
公共类BundleInfo
{
[xmlement(“WixPackageProperties”)]
公共集合包{get;set;}=new Collection();
}
公共静态类BundleInfo加载程序
{
私有静态只读字符串bootstrapperApplicationData=“bootstrapperApplicationData.xml”;
公共静态BundleInfo加载()
{
var bundleFolder=Path.GetDirectoryName(Assembly.getExecutionGassembly().Location);
var path=path.Combine(bundleFolder、bootstrapperApplicationData);
var xmlSerializer=新的xmlSerializer(typeof(BundleInfo));
BundleInfo结果;
使用(var fileStream=newfilestream(路径,FileMode.Open))
{
var xmlReader=xmlReader.Create(fileStream);
结果=(BundleInfo)xmlSerializer.Deserialize(xmlReader);
}
返回结果;
}
}

嘿,伙计,这个XML在哪里?我在我的bin/release目录中找不到它load方法找到了它。它将从程序集执行位置加载XML。当burn.exe运行时,它会在临时文件夹中创建一个子文件夹,并带有GUID。在该文件夹中,它创建了一个名为“.ba”的附加文件夹。在该文件夹中,您可以找到您的C#library。bootstrapper配置、一组支持文件和BootstrapperApplicationData.xml文件,这就是我在上面代码中加载的内容。