如果未安装,Wix安装程序将安装.net

时间:2013-02-11 17:10:29

标签: wix windows-installer prerequisites

我偶然发现了这份文件。 http://wix.sourceforge.net/manual-wix3/wixnetfxextension.htm

如果没有安装,我无法弄清楚如何安装.net4full。

目前我的wix xml看起来像这样:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <Product Id="*"
      .....
      .........
    >
        <PropertyRef Id="NETFRAMEWORK40FULL"/>
        <Condition Message="This application requires .NET Framework 4 FULL. Please install the .NET Framework then run this installer again.">
        <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
        </Condition>
        .....
        .........
        ............
        .........
        ............
    </Product>

    .......................
    ..............................
    ................................
    .........................
</Wix>
顺便说一句,我正在使用wix 3.7!

3 个答案:

答案 0 :(得分:1)

在Wix安装项目中,您可以检查.net framework 4.0是否存在并向用户发送消息,就像您必须在安装此产品之前安装.net framework 4.0一样。 但是如果你想默默地做(检查.net框架4.0存在...如果可用只安装你的产品,如果没有首先安装.net framework 4.0然后安装你的产品)你必须通过wix bootstrapper

答案 1 :(得分:1)

示例Bootstarpper代码如下

  <?xml version="1.0" encoding="utf-8"?>
   <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
        xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
          xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">

   <Bundle
     Name="My Application" Version="1.0.0.0"  UpgradeCode="8DA460D6-B4CB-4ED0-A1FE- 44F269070647" Manufacturer="ABC">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
  <bal:WixStandardBootstrapperApplication LicenseFile="Agreement.rtf"
           LogoFile="App.ico"/>
</BootstrapperApplicationRef>
<Chain> 
<PackageGroupRef Id="Netfx45Xxx"/>
     <MsiPackage SourceFile="D\MySetup.msi" Compressed="yes" EnableFeatureSelection="yes" Vital="yes">
     <MsiProperty Name='INSTALLFOLDER' Value='[InstallFolder]'/>      
  </MsiPackage> 
</Chain>
 <Variable Name='InstallFolder' Value='[ProgramFilesFolder]MyApp' />    

 <Fragment>
<PackageGroup Id="Netfx45Xxx" >
  <ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes" InstallCommand="/q"
      SourceFile="dotnetfx45_full_x86_x64.exe"
      DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
      InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))"/>
</PackageGroup>

  

此代码附加.net版本。如果.net 4.5在机器中不可用,它将在安装应用程序设置之前安装框架

答案 2 :(得分:0)

对我来说,使用 .NET 5 的解决方案是在应用程序文件夹中包含 [ApplicationName].runtimeconfig.json。