Get UE version in ModuleRules (.Build.cs file)

I know this will revive this old topic, but as this topic comes up pretty much top of the list on Google, there should be an updated response.

If you want to check the Unreal Engine version in any Build.cs, you can check with Target.Version.

Target.Version.MajorVersion, Target.Version.MinorVersion & Target.Version.PatchVersion are all the parts of the Unreal Engine version.

Console.WriteLine(String.Format("Unreal version {0}.{1}.{2}", Target.Version.MajorVersion, Target.Version.MinorVersion, Target.Version.PatchVersion));

You can also use ReadOnlyBuildVersion.Current to get the Version being used, in place of Target.Version. Hopefully this helps someone.

5 Likes