.net.net-coreinstall4jizpackbitrock

Determine .NET Core version during install (IzPack, BitRock, Install4J)


I am creating a service installer for various platforms (Windows and Linux/Unix for start). The install is pretty simple, just copy/unpack some files to chosen path, rewrite some settings text files, copy the service and start it. (Uninstall process is the reverse). A problem I'm having is in determining .NET Core version.

For Windows, using Inno Setup I did it by executing a commandLine command (dotnet --version), saving the result to a temp-file, reading it to a variable and deleting the temp-file.

I am aware, that similar approach could work for the Linux installer, but I'd like to do it a little cleaner than this. I'd like to use free IzPack, but I'm also considering to grab BitRock or Install4J, so advice about those could help me decide. The paid ones seem to only support determining .NET Framework version, not .NET Core.

Thanks


Solution

  • You can use something like this in izpack dynamic variables:

    <variable name="dotnet.version" executable="dotnet" type="process" ignorefailure="true">
      <arg>--version</arg>
      <filters>
        <regex regexp="... maybe filter the version from stdout by appropriate regex ..." />
      </filters>
    </variable>
    

    Then the version will be stored in a property and you can evaluate it or work with it however you want to.

    More on this topic can be found here in izpack documentation https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491552/Dynamic+Variables