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
Installation 在WiX中,如何测试安装的版本是否至少是特定版本?_Installation_Wix_Bundle_Burn_Wix3.6 - Fatal编程技术网

Installation 在WiX中,如何测试安装的版本是否至少是特定版本?

Installation 在WiX中,如何测试安装的版本是否至少是特定版本?,installation,wix,bundle,burn,wix3.6,Installation,Wix,Bundle,Burn,Wix3.6,我在建一个房子。我需要链接一个可执行包(实际上是平台6 SP1)。检测条件是某个注册表项存在,并且包含的版本号大于某个最低要求版本。如果不满足这些条件,则不满足先决条件,需要下载并安装EXE文件包 我编写的片段如下所示: <?xml version="1.0" encoding="UTF-8"?> <?include $(sys.CURRENTDIR)\Config.wxi?> <!-- Define a prerequisite for ASCOM Platfo

我在建一个房子。我需要链接一个可执行包(实际上是平台6 SP1)。检测条件是某个注册表项存在,并且包含的版本号大于某个最低要求版本。如果不满足这些条件,则不满足先决条件,需要下载并安装EXE文件包

我编写的片段如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<?include $(sys.CURRENTDIR)\Config.wxi?>

<!-- Define a prerequisite for ASCOM Platform 6 SP1 -->

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Fragment>
        <util:RegistrySearch Id="FindAscom6Installed"
                             Variable="AscomPlatform6Installed"
                             Root="HKLM"
                             Key="SOFTWARE\ASCOM\Platform"
                             Value="Platform Build"
                             Result="exists"
                             Win64="$(var.Win64)"
                             />
        <util:RegistrySearch Id="FindAscom6Build"
                             Variable="AscomPlatformBuild"
                             Root="HKLM"
                             Key="SOFTWARE\ASCOM\Platform"
                             Value="Platform Build"
                             Result="value"
                             Win64="$(var.Win64)"
                             />
        <PackageGroup Id="AscomPlatform6Sp1">
            <!-- If necessary, install ASCOM Platform version 6, do not uninstall
                 it during driver uninstall. -->

            <!-- DetectCondition="AscomPlatformInstalled AND AscomPlatformBuild >= 6.0.10028.2207" -->
            <ExePackage
               SourceFile="ASCOMPlatform6SP1.exe"
               DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild >= 6.0.10028.2207"
               DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
               PerMachine="yes"
               Permanent="yes"
               Vital="yes" />
        </PackageGroup>
    </Fragment>
</Wix>
我怀疑问题可能是,因为密钥不存在,所以AscomPlatform6Build为null,这是WiX不喜欢的


如何正确构造此检测条件?

您应该能够基于第一个条件向第二个RegistrySearch添加条件。如果同时为
AscomPlatformBuild
分配一个基值,则不会将其报告为null

<Variable Name="AscomPlatformBuild" Type="numeric" Value="1.0.0" />
...
<util:RegistrySearch Id="FindAscom6Build"
                     Variable="AscomPlatformBuild"
                     Root="HKLM"
                     Key="SOFTWARE\ASCOM\Platform"
                     Value="Platform Build"
                     Result="value"
                     Win64="$(var.Win64)"
                     Condition="AscomPlatform6Installed" />

...
ExePackage可以单独处理。

面临同样的问题。 通过在条件(即v6.0.10028.2207)中的版本常数之前添加v来解决此问题

<ExePackage
               SourceFile="ASCOMPlatform6SP1.exe"
               DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild >= v6.0.10028.2207"
               DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
               PerMachine="yes"
               Permanent="yes"
               Vital="yes" />


啊!非常感谢。这确实清除了错误,但是现在我的包没有做任何事情。但这是另一个问题,我又向前迈进了一步。衷心感谢您回答我的问题+1并被接受。但有一个问题。。。为什么变量类型必须是数字而不是版本?(版本不起作用,我试过了)。我不知道。我也无法让它工作,而且我还没有看到任何关于“版本”应该是什么的文档。“版本”类型的常量的形式为“v1.0.0.0”,可以使用正常的比较运算符进行比较。我假设这允许他们执行正确的版本比较(即,主要,然后次要,等等),而不仅仅是一个愚蠢的数字或字符串比较。
<ExePackage
               SourceFile="ASCOMPlatform6SP1.exe"
               DetectCondition="AscomPlatform6Installed AND AscomPlatformBuild >= v6.0.10028.2207"
               DownloadUrl="http://download.ascom-standards.org/ASCOMPlatform6SP1.exe"
               PerMachine="yes"
               Permanent="yes"
               Vital="yes" />