2

Since there is no Wix equivalent to Netfx.wixext for .NET Core (i.e. 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 (i.e. 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. This results in failing to detect build version differences correctly since I can't detect "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.

What other options do I have to install runtimes and detect future version of the same .NET Core Family (Major.Minor)?

Here is the snippet of wix code which is relevant:

<?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>
Riley
  • 37
  • 1
  • 6

1 Answers1

4
  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.

  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.

  3. You can run code in a bundle by writing a custom 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.

Sean Hall
  • 7,629
  • 2
  • 29
  • 44
  • Ended up coming up and implementing #2. Auto generated the list with a powershell script. Thanks for the reply, it was hard to find documentation indicating that this effectively wasn't directly supported. – Riley Apr 22 '21 at 17:18