0

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

XzajoX
  • 23
  • 6
  • You don't need to do that at all. You can bundle the .NET Core version you want with your application by using the `self-contained` flag when publishing. As for something cleaner that `dotnet --version`, that's the Linux way. Combine multiple small tools to do your job. Just as you'd type `ps aux | grep -i firefox` to get a process's `dotnet --version |grep -x 2.2.1` will return a line only if `2.2.1` is installed and `dotnet --version |grep 2.2` will return a line only if at least one `2.2` version is installed – Panagiotis Kanavos Feb 20 '19 at 10:14
  • @PanagiotisKanavos Thanks. Yes, it's true, that publishing the service with self-contained .NET Core is a solution. But then the installer is not 9 MB but 99 MB and that is not an option. Thanks for the commands, but the problem is not in the command itself, but in how to run a command and get its result/response back to the installer to work with. – XzajoX Feb 20 '19 at 12:07

1 Answers1

0

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