使用Wix Installer 3.11检测.Net 4.7

时间:2017-05-25 15:39:37

标签: .net wix installer

关于如何在Wix中处理.Net 4.7的任何想法? 该文档仅显示对462的支持,除非我遗漏了某些内容。 here 我发现了这个:http://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html但我从未使用它。 任何建议表示赞赏!

TNX!

1 个答案:

答案 0 :(得分:4)

当您在捆绑链中添加<PackageGroupRef Id="NetFx47Redist"/>时,以下片段(从4.6.2修改)应该有效。这需要离线安装程序(从NetFx47RedistLink下载)出现在相关源路径.. \ Redist \ NETFX47文件夹中以进行包编译。您还需要在包的引用中添加NetFxExtension,并在包wxs中添加`xmlns:netfx ='http://schemas.microsoft.com/wix/NetFxExtension'。

<Fragment>
    <?define NetFx47MinRelease = 460798 ?>
    <?define NetFx47WebLink = http://download.microsoft.com/download/A/E/A/AEAE0F3F-96E9-4711-AADA-5E35EF902306/NDP47-KB3186500-Web.exe ?>
    <?define NetFx47RedistLink = http://download.microsoft.com/download/D/D/3/DD35CC25-6E9C-484B-A746-C5BE0C923290/NDP47-KB3186497-x86-x64-AllOS-ENU.exe ?>
    <?define NetFx47EulaLink = http://referencesource.microsoft.com/license.html ?>

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx47Redist" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx47EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx47RedistDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx47MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx47RedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx47RedistPackageDirectory" Value="Redist\NETFX47\" Overridable="yes" />

    <PackageGroup Id="NetFx47Redist">
        <ExePackage
            DisplayName="Microsoft .NET Framework 4.7"
            InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
            RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
            UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
            PerMachine="yes"
            DetectCondition="!(wix.NetFx47RedistDetectCondition)"
            InstallCondition="!(wix.NetFx47RedistInstallCondition)"
            Id="NetFx47Redist"
            Vital="yes"
            Permanent="yes"
            Protocol="netfx4"
            DownloadUrl="$(var.NetFx47RedistLink)"
            LogPathVariable="NetFx47FullLog"
            Compressed="no"
            SourceFile="..\Redist\NETFX47\NDP47-KB3186497-x86-x64-AllOS-ENU.exe"
            Name="!(wix.NetFx47RedistPackageDirectory)NDP47-KB3186497-x86-x64-AllOS-ENU.exe"
        >
        </ExePackage>
    </PackageGroup>
</Fragment>

您还需要添加以下使用Util扩展的RegistrySearch,将其添加到引用中以及捆绑中的xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'

        <util:RegistrySearch
            Id="NETFRAMEWORK45"
            Variable="NETFRAMEWORK45"
            Root="HKLM"
            Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
            Value="Release"
            Result="value"
        />