0

在继续安装之前,我需要检查是否安装了 .NET 版本 4.5。这是我的 .wxs 文件。我已将 propertyref 和 condition 放在标签下。为什么这个检查不起作用?

即使目标系统上不存在 .NET 4.5,安装仍会继续进行。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*"
             Name="SolidFire Hardware Provider"
             Language="1033"
             Version="1.0.0.0"
             Manufacturer="SolidFire"
             UpgradeCode="0c60967f-f184-4b8b-a96a-b1caa4a8879e">
        <Package InstallerVersion="200" 
                 Compressed="yes" 
                 InstallScope="perMachine" />
        <!--Media Id='2' Cabinet='provider.cab' EmbedCab='yes'/-->
        <PropertyRef Id="NETFRAMEWORK45"/>

        <Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
          <![CDATA[Installed OR NETFRAMEWORK45]]>
        </Condition>

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab='yes'/>

        <Feature Id="ProductFeature" Title="InstallProvider" Level="1">
          <ComponentGroupRef Id="ProductComponents" />
        </Feature>
        <!-- IRef Id="WixUI_Minimal"/-->

        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" ></Property>
        <!--Property WixUIDialogBmp = "logo.bmp"></Property-->
        <UIRef Id="WixUI_InstallDir"/>

        <InstallExecuteSequence>
          <Custom Action="RunInstallScript" After="InstallFiles" >NOT Installed</Custom>
        </InstallExecuteSequence>
        <InstallExecuteSequence>
          <Custom Action='BeforeUninstall' Before='RemoveFiles'>REMOVE="ALL"</Custom>
        </InstallExecuteSequence>
        <CustomAction Id="RunInstallScript"
                      ExeCommand="cmd /c install-solidfireprovider.cmd"
                      Directory="INSTALLFOLDER"
                      Execute="deferred"
                      Return="check"/>
        <CustomAction Id="BeforeUninstall"
                      ExeCommand="cmd /c uninstall-solidfireprovider.cmd"
                      Directory="INSTALLFOLDER"
                      Execute="deferred"
                      Return="check"/>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="solidfireinstall" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <Component Id="ProductComponent">
                <!-- TODO: Insert files, registry keys, and other resources here. -->
                <File Id="restinterfacedll.dll"
                      Source="..\vssprovider\x64\$(var.build)\RESTInterfacedll.dll"></File>
            </Component>

            <Component Id="vssdll">
                <File Id="vsssolidfireprovider.dll"
                  Source="..\vssprovider\x64\$(var.build)\vsssolidfireprovider.dll"></File>
            </Component>

            <Component Id="installscript">
                <File Id="installscript"
                  Source="install-solidfireprovider.cmd"></File>
            </Component>

            <Component Id="uninstallscript">
                <File Id="uninstallscript"
                  Source="uninstall-solidfireprovider.cmd"></File>
            </Component>

            <Component Id="registerprovider">
                <File Id="registerprovider"
                  Source="register_app.vbs"></File>
            </Component>

            <Component Id="vshadow">
                <File Id="vshadow"
                  Source="vshadow.exe"></File>
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>
4

1 回答 1

0

看起来不错,所以您可能还需要:

“在调用 light.exe 时添加 -ext 命令行参数以在 MSI 链接过程中包含 WixNetfxExtension。”

于 2013-08-29T09:16:43.003 回答