繁体   English   中英

如何使用 wix 中的 .NET Core Runtime 先决条件安装网络核心应用程序

[英]How to install a net core application with .NET Core Runtime prerequisite from wix

由于 .NET 核心没有与 Netfx.wixext 等效的 Wix (即指定内置 ID 以检测和要求运行时),我似乎找不到正确安装 Z303CB0EF9EDB9082D61BBBE5825D972 等各种条件的方法存在于同一版本系列(即 3.1)中的版本。

我尝试在刻录项目中直接使用 .NET Core 安装程序可执行文件,但出现的问题是,似乎只能通过目录或文件搜索来实现检测。 这导致无法正确检测构建版本差异,因为我无法检测到“3.1.*”。

我尝试为 Wix Bundle 构建自定义操作,以根据已安装的 .NET Core 版本以编程方式检测和设置属性——但我当然意识到 Burn 包不能有自定义操作。

我还需要哪些其他选项来安装运行时并检测相同 .NET 核心系列(Major.Minor)的未来版本?

这是相关的 wix 代码片段:

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

    <Fragment>
      <Variable Name="DotnetCoreRuntime31InstallDir" Value="[ProgramFiles64Folder]dotnet\shared\Microsoft.NETCore.App\3.1.12" />
      <util:DirectorySearch Id="DotnetCoreRuntime31Installed" Path="[DotnetCoreRuntime31InstallDir]" Variable="DotnetCoreRuntime31Installed" Result="exists" />
      <WixVariable Id="DotnetCoreRuntime31WebDetectCondition" Value="DotnetCoreRuntime31Installed" Overridable="yes" />
      <WixVariable Id="DotnetCoreRuntime31WebInstallCondition" Value="" Overridable="yes" />


      <Variable Name="AspNetCoreRuntime31InstallDir" Value="[ProgramFiles64Folder]dotnet\shared\Microsoft.AspNetCore.App\3.1.12" />
      <util:DirectorySearch Id="AspNetCoreRuntime31Installed" Path="[AspNetCoreRuntime31InstallDir]" Variable="AspNetCoreRuntime31Installed" Result="exists" />
      <WixVariable Id="AspNetCoreRuntime31WebDetectCondition" Value="AspNetCoreRuntime31Installed" Overridable="yes" />
      <WixVariable Id="AspNetCoreRuntime31WebInstallCondition" Value="" Overridable="yes" />
      
      <PackageGroup Id="AllNetCoreRuntime31">
        
        <ExePackage
            Name="dotnet-runtime-3.1.12-win-x64.exe"
            SourceFile="Resources\dotnet-runtime-3.1.12-win-x64.exe"
            InstallCommand="/install /quiet /norestart /log &quot;[DotnetCoreRuntime31Log]&quot;"
            RepairCommand="/repair /quiet /norestart /log &quot;[DotnetCoreRuntime31Log]&quot;"
            UninstallCommand="/uninstall /quiet /norestart /log &quot;[DotnetCoreRuntime31Log]&quot;"
            PerMachine="yes"
            DetectCondition="!(wix.DotnetCoreRuntime31WebDetectCondition)"
            InstallCondition="!(wix.DotnetCoreRuntime31WebInstallCondition)"
            Vital="yes"
            Permanent="yes"
            Protocol="burn"
            LogPathVariable="DotnetCoreRuntime31Log"
            Compressed="yes" />

          <ExePackage
            Name="aspnetcore-runtime-3.1.12-win-x64.exe"
            SourceFile="Resources\aspnetcore-runtime-3.1.12-win-x64.exe"
            InstallCommand="/install /quiet /norestart /log &quot;[AspNetCoreRuntime31Log]&quot;"
            RepairCommand="/repair /quiet /norestart /log &quot;[AspNetCoreRuntime31Log]&quot;"
            UninstallCommand="/uninstall /quiet /norestart /log &quot;[AspNetCoreRuntime31Log]&quot;"
            PerMachine="yes"
            DetectCondition="!(wix.AspNetCoreRuntime31WebDetectCondition)"
            InstallCondition="!(wix.AspNetCoreRuntime31WebInstallCondition)"
            Vital="yes"
            Permanent="yes"
            Protocol="burn"
            LogPathVariable="AspNetCoreRuntime31Log"
            Compressed="yes">   
        </ExePackage>
      </PackageGroup>
    </Fragment>
    
</Wix>
  1. 我们希望将此功能内置到 v4 - https://github.com/wixtoolset/issues/issues/6257https://github.com/wixtoolset/issues/issues/6264

  2. 目前,由于 .NET Core 的版本控制是可预测的,并且具有预定义的支持 windows 和发布节奏,因此您可以通过搜索所有 36 种可能的版本来强制搜索。

  3. 您可以通过编写自定义 BootstrapperApplication 以捆绑方式运行代码。 如果您使用的是内置的 BA wixstdba ,它有一个名为 BAFunctions 的扩展点,您可以在其中编写自己的(本机).dll。

暂无
暂无

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

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