检查安装在WiX安装程序中的.NET?在哪里放置条件?

时间:2013-08-29 06:39:06

标签: wix

在继续安装之前,我需要检查是否安装了.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>

1 个答案:

答案 0 :(得分:0)

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

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