0

我正在阅读 wix 的教程和手册,并试图弄清楚如何应用安装前检测,比如检测机器上是否安装了 Visual Studio 2012 和 Update 2。

以下是wix源代码,但我不确定注册表项是否是检测的先决条件。

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dd="http://schemas.microsoft.com/wix/2005/01/dd">
<!-- Detection keys fragment. -->
<Fragment>
    <!-- TARGETDIR should be set by a type 51 CA to the root installation location for all products. -->
    <DirectoryRef Id="TARGETDIR">
        <!-- Use all variables in the full key path for the auto-generated GUID, 
             including LANG, since [ProductName] is lang-specific. 
        -->
        <Component Id="Detection_Keys_Reg" Guid="$(autoguid.ComponentGuid(Detection_Keys_Reg,$(var.ProductFamily),$(var.ProductEdition),$(var.VSRegVer),$(var.Lang)))">
            <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\$(var.VSRegVer)\Setup\[ProductName]">
                <RegistryValue Id="Detection_Keys_RegKey_1" Name="InstallSuccess" Type="integer" Value="1" KeyPath="yes" />
                <RegistryValue Id="Detection_Keys_RegKey_2" Name="SrcPath" Type="string" Value="[SourceDir]" />
            </RegistryKey>
        </Component>
    </DirectoryRef>
    <Feature Id="Detection_Keys" Absent="disallow" AllowAdvertise="no" Description="Used to detect product installation" Display="hidden" Level="1" InstallDefault="local" Title="Detection" TypicalDefault="install">
        <ComponentRef Id="Detection_Keys_Reg" />
        <dd:ExtensionData FeatureGuid="67DC7E25-1836-42AA-A0F8-6E85528D6986" InstallDirectory="TARGETDIR" AllowRunFromSource="no" FeatureGFN="DetectionKeys">Detection Keys</dd:ExtensionData>
    </Feature>
</Fragment>

文件夹中的两个注册表项

“HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Setup\Microsoft Visual Studio Ultimate 2012\”

在我安装 VS2012 后确实存在(但不在 HKLM 中)。我不明白一些标签(仍在阅读手册)

所以问题是:1.这是为了检测吗?2. 需要的软件不存在时,如何写一些弹窗信息。

您能否为此提供一些典型的样本?

谢谢!

4

2 回答 2

1

尝试在Condition元素中使用Product元素。引用条件元素的 WiX 文档:在 Fragment 或 Product 元素下,条件变为 LaunchCondition 条目。

如果条件失败,安装将中止,并显示您希望它显示的消息。

一个非常简单的例子:

  <Condition Message="Minimum 1 GB of RAM required. Aborting installation.">
    <![CDATA[Installed OR PhysicalMemory >= 1024]]>
  </Condition>

如果您想使用注册表项,请使用以下RegistrySearch元素设置属性:

  <Property Id="TEST">
    <RegistrySearch Id="TestRegKey"
                    Root="HKLM"
                    Key="Software\TestKey"
                    Name="Version"
                    Type="raw" />
  </Property>

现在您可以在 Condition 的内部文本中使用此属性。

于 2013-06-17T13:42:34.257 回答
1

1.用于VS/更新检测的注册表键

您可以使用以下注册表进行检测,其值为 UpdatedVersion= CurrentBuildNumber=11.0.60315 For VSUpdate2

注册表项 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\12.0\professional

2.如果您的意图是搜索VSUpdate2,您需要使用registrysearch Tag,它将为您搜索值。更新值后,您可以在托管 UX 中弹出自定义逻辑

于 2013-06-14T08:57:13.717 回答