WiX - .NET 4.0先决条件增加文件大小?

时间:2014-02-27 12:41:28

标签: .net wix windows-installer

以下是我用于WiX引导程序安装程序的代码:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Bundle Name='My Application Version 3.5'  Version='3.5.0' Manufacturer='Company'       UpgradeCode='{49DF3192-2631-4636-9279-E4F913077C57}'>
            <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

              <Chain>
                <PackageGroupRef Id="Netfx4Full"/>
                <MsiPackage SourceFile="MyApplicationToInstall.msi" Compressed="no"/>
              </Chain>
  </Bundle>

        <Fragment>
            <!--check for .NET 4.0-->
            <util:RegistrySearch
                Root="HKLM"
                Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                Value="Version" Variable="Netfx40FullVersion"/>

            <util:RegistrySearch
                Root="HKLM"
                Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                Value="Version"
                Variable="Netfx40x64FullVersion"
                Win64="yes"/>

            <PackageGroup Id="Netfx4Full">
                <ExePackage Id="Netfx4Full"
                     DisplayName="Microsoft .NET Framework 4.0"
                     DownloadUrl="http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
                     Compressed="no"
                     Cache="no"
                     PerMachine="yes"
                     Permanent="yes"
                     Vital="yes"
                     Protocol="netfx4"
                     SourceFile=".\dotNetFx40_Full_x86_x64.exe"
                     InstallCommand="/passive /norestart"
                     DetectCondition="Netfx40FullVersion AND (NOT VersionNT64 OR Netfx40x64FullVersion)" />
            </PackageGroup>
        </Fragment>
    </Wix>

出于某种原因,.NET 4的先决条件导致3 MB应用程序增加到99 MB的文件大小。当我删除先决条件时,它下降到它应该是的大小(3 MB)。经过一些研究,我将缓存从“是”改为“否”,将其从99 MB减少到50 MB。

我对WiX比较陌生,所以我错过了什么?我是否错误地写了先决条件?

编辑:原始程序是使用VS2010的安装程序模板(现已停止使用)安装的,该模板在运行时安装此程序的前提条件与我编写的WiX替代程序相同,但安装结果安装了3 MB程序和.NET作为单独的实体。

1 个答案:

答案 0 :(得分:0)

尝试使用RemotePayload而不是指定SourceFile。我用来安装.NET 3.5的示例代码:

<PackageGroup Id="DotNetFx35">
  <ExePackage 
    InstallCommand="/lang:enu /passive /qb /norestart" 
    PerMachine="yes" 
    DetectCondition="NETFX35" 
    InstallCondition="NOT NETFX35" 
    Id="DotNetFx35" 
    Vital="yes" 
    Permanent="yes" 
    Protocol="none" 
    DownloadUrl="http://go.microsoft.com/fwlink/?linkid=118076" 
    Compressed="no" 
    Name="dotnetfx35setup.exe">
    <RemotePayload 
      Size="2959376" 
      Version="3.5.30792.01" 
      ProductName="Microsoft .NET Framework 3.5" 
      Description="Microsoft .NET Framework 3.5 Setup"            Hash="ec9f0c31b9949ca1cf14e9a43bca065fa5bc0e71" /> 
  </ExePackage>
  </PackageGroup>