C# 如何从wix安装具有.net core运行时先决条件的net core应用程序

C# 如何从wix安装具有.net core运行时先决条件的net core应用程序,c#,.net-core,wix,burn,wix3.11,C#,.net Core,Wix,Burn,Wix3.11,由于没有与.NET Core的Netfx.wixext等效的Wix(即指定内置ID以检测和要求运行时),我似乎无法找到正确安装.NET Core的方法,也无法解释各种情况,例如同一版本系列(即3.1)中存在的较新版本 我曾尝试在burn项目中直接使用.NET Core安装程序可执行文件,但问题是,似乎只有通过目录或文件搜索才能实现检测。这导致无法正确检测生成版本差异,因为我无法检测“3.1.*” 我试图为Wix捆绑包构建一个自定义操作,以编程方式根据已安装的.NET核心版本检测和设置属性——但我

由于没有与.NET Core的Netfx.wixext等效的Wix(即指定内置ID以检测和要求运行时),我似乎无法找到正确安装.NET Core的方法,也无法解释各种情况,例如同一版本系列(即3.1)中存在的较新版本

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

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

要安装运行时并检测同一.NET Core系列(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>

  • 我们希望将此功能内置到v4和中

  • 目前,由于.NET Core的版本控制是可预测的,并且具有预定义的支持窗口和发行版cadence,因此您可以通过搜索所有可能的版本来强制搜索

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


  • 最终提出并实施了#2。使用powershell脚本自动生成列表。感谢您的回复,很难找到文件表明这实际上没有得到直接支持。