What is the recommended way to determine the Mono runtime version programmatically?
We have encountered various problems when our .Net application is used with older versions of Mono. Sometimes we can work around these problems, if we know which version we are dealing with, but sometimes we can’t.
The solution for us would be to detect the Mono version programmatically, and then we can transparently apply the workarounds. If the Mono version is too old, then we would prompt the user to upgrade.
We can discover that Mono is our runtime with something like this:
bool isMonoRuntime = Type.GetType("Mono.Runtime") != null;
How can we also determine reliably the mono version without inferring it indirectly? To be clear, we need the Mono release number, not the .Net CLR version number.
You can check the mono runtime version as:
Check this How to determine the revision from which current Mono runtime was built and installed? for more details.