Skip to content

Getting the Operating System Version Information

Sometimes it is useful to know the version of the operating system your app is running on. You might use this information to access a feature that is only available on certain OS versions or perhaps you want to include it in logging data to help troubleshoot.

Either way, you can fetch this information from the System.VersionData class, which you access from the System.Version method. You can get the specific MajorVersion, MinorVersion and PatchVersion numbers. For display purposes you can get the version as a string with the ToString method:

Label1.Text = System.Version.ToString

Here is what you might see for various operating systems:

macOS
Linux

Windows

iOS
Android

For more on this topic see other posts: Using IDE and System Version Specific Code and Tip: Get the OS version in your Xojo Apps.