简体   繁体   English

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

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

Since there is no Wix equivalent to Netfx.wixext for .NET Core (ie specifying built in Ids to detect and require runtimes), I can't seem to find a way to correctly install .NET Core and also account for various conditions such as a newer version existing in the same version family (ie 3.1).由于 .NET 核心没有与 Netfx.wixext 等效的 Wix (即指定内置 ID 以检测和要求运行时),我似乎找不到正确安装 Z303CB0EF9EDB9082D61BBBE5825D972 等各种条件的方法存在于同一版本系列(即 3.1)中的版本。

I've tried to utilize the .NET Core installer executable directly in a burn project, but the problem arises that detection only seems to be able to be achieved with Directory or File searches.我尝试在刻录项目中直接使用 .NET Core 安装程序可执行文件,但出现的问题是,似乎只能通过目录或文件搜索来实现检测。 This results in failing to detect build version differences correctly since I can't detect "3.1.*".这导致无法正确检测构建版本差异,因为我无法检测到“3.1.*”。

I tried to build a custom action for the Wix Bundle to programmatically detect and set properties based upon installed .NET Core versions -- But of course I realized that Burn bundles cannot have custom actions.我尝试为 Wix Bundle 构建自定义操作,以根据已安装的 .NET Core 版本以编程方式检测和设置属性——但我当然意识到 Burn 包不能有自定义操作。

What other options do I have to install runtimes and detect future version of the same .NET Core Family (Major.Minor)?我还需要哪些其他选项来安装运行时并检测相同 .NET 核心系列(Major.Minor)的未来版本?

Here is the snippet of wix code which is relevant:这是相关的 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. We hope to get this functionality built in to v4 - https://github.com/wixtoolset/issues/issues/6257 and https://github.com/wixtoolset/issues/issues/6264 .我们希望将此功能内置到 v4 - https://github.com/wixtoolset/issues/issues/6257https://github.com/wixtoolset/issues/issues/6264

  2. For now, because the versioning for .NET Core is predictable and with predefined support windows and release cadence, you could brute force the search by searching for all 36-ish possible versions.目前,由于 .NET Core 的版本控制是可预测的,并且具有预定义的支持 windows 和发布节奏,因此您可以通过搜索所有 36 种可能的版本来强制搜索。

  3. You can run code in a bundle by writing a custom BootstrapperApplication.您可以通过编写自定义 BootstrapperApplication 以捆绑方式运行代码。 If you're using the built-in BA wixstdba , it has an extensibility point called BAFunctions where you can write your own (native).dll.如果您使用的是内置的 BA wixstdba ,它有一个名为 BAFunctions 的扩展点,您可以在其中编写自己的(本机).dll。

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

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