繁体   English   中英

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

[英]Wix installer install .net if not installed

我偶然发现了这个文档。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!

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

示例 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 在机器中不可用,它将在安装应用程序设置之前安装框架

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM